aboutsummaryrefslogtreecommitdiffstats
path: root/src/ckerrlog.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ckerrlog.c')
-rw-r--r--src/ckerrlog.c37
1 files changed, 33 insertions, 4 deletions
diff --git a/src/ckerrlog.c b/src/ckerrlog.c
index 1be1c08..9e1fc51 100644
--- a/src/ckerrlog.c
+++ b/src/ckerrlog.c
@@ -15,11 +15,13 @@
#define COMPONENT "ckerrlog"
-static char *err;
-static char *log;
static int loglvl;
static char buf[STR_M];
+#define X(stream) static char *stream;
+CK_STREAMS
+#undef X
+
char * get_time() {
time_t rawtime;
struct tm * timeinfo;
@@ -30,8 +32,9 @@ char * get_time() {
}
void initialize_errlog() {
- err = NULL;
- log = NULL;
+#define X(stream) stream = NULL;
+ CK_STREAMS
+#undef X
loglvl = 0;
cklog("%s Log session started", get_time());
}
@@ -78,9 +81,35 @@ void cklog(char *txt, ...) {
va_end(args);
}
+void ckhelp(char *txt, ...) {
+ va_list args;
+ va_start(args, txt);
+ add_help_with_delim("\n", txt, args);
+ va_end(args);
+}
+
void ckerr_add_component(char *txt, ...) {
va_list args;
va_start(args, txt);
add_err_with_delim(" ", txt, args);
va_end(args);
}
+
+void ckhelp_add_component(char *txt, ...) {
+ va_list args;
+ va_start(args, txt);
+ add_help_with_delim(" ", txt, args);
+ va_end(args);
+}
+
+void report_err() {
+ printf("%s", err);
+ free(err);
+ err = NULL;
+}
+
+void report_help() {
+ printf("%s", help);
+ free(help);
+ help = NULL;
+}