aboutsummaryrefslogtreecommitdiffstats
path: root/src/ckerrlog.c
diff options
context:
space:
mode:
authorAnastasis Grammenos <anastasis.gramm2@gmail.com>2018-10-04 15:46:42 +0300
committerAnastasis Grammenos <anastasis.gramm2@gmail.com>2018-10-04 15:46:42 +0300
commit9c24e438b689af042672182f6d87f824ef435492 (patch)
tree9f91c4951bd2e4a799868b0a3369161918045a6e /src/ckerrlog.c
parentfa41863b03bbf67a7ad4edad9328b0cdc48e497b (diff)
downloadck-9c24e438b689af042672182f6d87f824ef435492.tar.gz
ck-9c24e438b689af042672182f6d87f824ef435492.tar.bz2
ck-9c24e438b689af042672182f6d87f824ef435492.zip
More error/logs and fix failing test
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;
+}