diff options
author | Anastasis Grammenos <anastasis.gramm2@gmail.com> | 2018-10-05 18:16:16 +0300 |
---|---|---|
committer | Anastasis Grammenos <anastasis.gramm2@gmail.com> | 2018-10-05 19:36:11 +0300 |
commit | a0db476bed7d7b814c426d23b55a74d585a6d8cb (patch) | |
tree | ffde1fae7d75701e7dba31cf53077a9ca21b3a53 /src/ckerrlog.c | |
parent | 764a205fe9676afcdb94998b5e553d650bda86ba (diff) | |
download | ck-a0db476bed7d7b814c426d23b55a74d585a6d8cb.tar.gz ck-a0db476bed7d7b814c426d23b55a74d585a6d8cb.tar.bz2 ck-a0db476bed7d7b814c426d23b55a74d585a6d8cb.zip |
errlog in actionparser and configparser
Diffstat (limited to 'src/ckerrlog.c')
-rw-r--r-- | src/ckerrlog.c | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/src/ckerrlog.c b/src/ckerrlog.c index 9a63ffd..357d112 100644 --- a/src/ckerrlog.c +++ b/src/ckerrlog.c @@ -14,7 +14,7 @@ #include "ckutil.h" #include "cklist.h" -ERRLOG(ckerrlog); +ERRLOG(logger); static int loglvl; static char buf[STR_M]; @@ -32,12 +32,13 @@ char * get_time() { return buf; } -void initialize_errlog() { -#define X(stream) stream = NULL; - CK_STREAMS -#undef X - loglvl = 0; - cklog("%s Log session started", get_time()); +void log_command(int argc, char* argv[]) { + char tmp[STR_L] = ""; + for(int i = 0; i < argc; i++) { + strcat(tmp, argv[i]); + strcat(tmp, " "); + } + LOG("Command issued: %s", tmp); } #define X(stream) \ @@ -66,6 +67,16 @@ CK_STREAMS CK_STREAMS #undef X +#define X(stream) \ + void ck## stream ##_with_delim(char *d, char *txt, ...) { \ + va_list args; \ + va_start(args, txt); \ + add_## stream ##_with_delim(d, txt, args); \ + va_end(args); \ + } +CK_STREAMS +#undef X + #define X(stream) \ void reset_## stream() { \ list_free(stream); \ @@ -111,3 +122,13 @@ void ckerr_add_component(char *txt, ...) { extern void errlog_set_verbose(int level) { loglvl = level; } + + +void initialize_errlog(int argc, char* argv[]) { +#define X(stream) stream = NULL; + CK_STREAMS +#undef X + loglvl = 0; + LOG("%s Log session started", get_time()); + log_command(argc, argv); +} |