aboutsummaryrefslogtreecommitdiffstats
path: root/src/ckerrlog.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ckerrlog.c')
-rw-r--r--src/ckerrlog.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/ckerrlog.c b/src/ckerrlog.c
index cf5a6e8..5605fbd 100644
--- a/src/ckerrlog.c
+++ b/src/ckerrlog.c
@@ -16,13 +16,14 @@
ERRLOG(logger);
static int loglvl;
+static char logfile[STR_L] = "";
static char buf[STR_M] = "";
#define X(stream) static cklist *stream;
CK_STREAMS
#undef X
-char *get_time() {
+static char *get_time() {
time_t rawtime;
struct tm * timeinfo;
time (&rawtime);
@@ -94,6 +95,16 @@ CK_STREAMS
#undef X
void report_errlog() {
+ LOG("------- end -------\n");
+ if (!str_is_empty(logfile)) {
+#define X(stream) \
+ if (stream) { \
+ list_write_to_file(stream, logfile, 1); \
+ }
+ CK_STREAMS
+#undef X
+ }
+
if (!loglvl) {
#define X(stream) \
if (stream) { \
@@ -119,11 +130,17 @@ void ckerr_add_component(char *txt, ...) {
va_end(args);
}
+void errlog_make_logfile(char *logdir) {
+ if (!logdir) {
+ return;
+ }
+ str_join_dirname_with_basename(logfile, logdir, "ck.log");
+}
+
void errlog_set_verbose(int level) {
loglvl = level;
}
-
void initialize_errlog(int argc, const char** argv) {
#define X(stream) stream = NULL;
CK_STREAMS