From b89f2203e7cd0caa850ef825f5c7f9f6589ab4e4 Mon Sep 17 00:00:00 2001 From: Davide Paro Date: Sun, 14 Feb 2021 20:48:08 +0100 Subject: [PATCH] Nicer logging --- src/log.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/log.c b/src/log.c index 0939b4a..97ed1cf 100644 --- a/src/log.c +++ b/src/log.c @@ -40,7 +40,7 @@ static struct { static const char *level_strings[] = { - "DEBUG", "TRACE", "INFO", "WARN", "ERROR", "FATAL" + "[[DEBUG]]", "[[TRACE]]", "[[ INFO]]", "[[ WARN]]", "[[ERROR]]", "[[FATAL]]" }; @@ -69,12 +69,12 @@ static void stdout_callback(log_Event *ev) { buf[strftime(buf, sizeof(buf), "%H:%M:%S", ev->time)] = '\0'; #ifdef LOG_USE_COLOR fprintf( - ev->udata, "%s %s%-5s\x1b[0m \x1b[90m%s:%d:\x1b[0m ", + ev->udata, "%s %s%-7s\x1b[0m \x1b[90m%s:%d:\x1b[0m ", buf, get_level_color(ev->level), get_level_string(ev->level), ev->file, ev->line); #else fprintf( - ev->udata, "%s %-5s %s:%d: ", + ev->udata, "%s %-7s %s:%d: ", buf, get_level_string(ev->level), ev->file, ev->line); #endif vfprintf(ev->udata, ev->fmt, ev->ap); @@ -87,7 +87,7 @@ static void file_callback(log_Event *ev) { char buf[64]; buf[strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", ev->time)] = '\0'; fprintf( - ev->udata, "%s %-5s %s:%d: ", + ev->udata, "%s %-7s %s:%d: ", buf, get_level_string(ev->level), ev->file, ev->line); vfprintf(ev->udata, ev->fmt, ev->ap); fprintf(ev->udata, "\n");