From 8899e8650c0c42b289092aa5350a4bb2f95f865e Mon Sep 17 00:00:00 2001 From: Rodolfo Castillo Mateluna Date: Wed, 31 Jul 2019 13:02:08 -0400 Subject: [PATCH 1/2] Add support for C++ --- src/log.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/log.h b/src/log.h index b3df494..3f600de 100644 --- a/src/log.h +++ b/src/log.h @@ -8,6 +8,10 @@ #ifndef LOG_H #define LOG_H +#ifdef __cplusplus +extern "C" { +#endif + #include #include @@ -32,4 +36,8 @@ void log_set_quiet(int enable); void log_log(int level, const char *file, int line, const char *fmt, ...); +#ifdef __cplusplus +} +#endif + #endif From 536bf40e9e463cd14b71a2bbeb544fda35757c91 Mon Sep 17 00:00:00 2001 From: Rodolfo Castillo Mateluna Date: Fri, 15 May 2020 02:20:07 -0400 Subject: [PATCH 2/2] Add date to stderr --- src/log.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/log.c b/src/log.c index 2e183b0..89a1f6d 100644 --- a/src/log.c +++ b/src/log.c @@ -102,8 +102,8 @@ void log_log(int level, const char *file, int line, const char *fmt, ...) { /* Log to stderr */ if (!L.quiet) { va_list args; - char buf[16]; - buf[strftime(buf, sizeof(buf), "%H:%M:%S", lt)] = '\0'; + char buf[32]; + buf[strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", lt)] = '\0'; #ifdef LOG_USE_COLOR fprintf( stderr, "%s %s%-5s\x1b[0m \x1b[90m%s:%d:\x1b[0m ",