From: wwp Date: Tue, 14 May 2019 08:09:12 +0000 (+0200) Subject: Add date (ISO format) to log timestamps. X-Git-Tag: 3.17.4~26 X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=commitdiff_plain;h=00081bf42a2c4a02d3aa0e6fc2058f8cc49414b0 Add date (ISO format) to log timestamps. --- diff --git a/src/common/log.c b/src/common/log.c index 344eb97f2..1a399b842 100644 --- a/src/common/log.c +++ b/src/common/log.c @@ -199,7 +199,7 @@ void log_print(LogInstance instance, const gchar *format, ...) struct tm buft; time(&t); - strftime(buf, LOG_TIME_LEN + 1, "[%H:%M:%S] ", localtime_r(&t, &buft)); + strftime(buf, LOG_TIME_LEN + 1, "[%Y-%m-%d %H:%M:%S] ", localtime_r(&t, &buft)); va_start(args, format); g_vsnprintf(buf + LOG_TIME_LEN, BUFFSIZE, format, args); @@ -230,7 +230,7 @@ void log_message(LogInstance instance, const gchar *format, ...) struct tm buft; time(&t); - strftime(buf, LOG_TIME_LEN + 1, "[%H:%M:%S] ", localtime_r(&t, &buft)); + strftime(buf, LOG_TIME_LEN + 1, "[%Y-%m-%d %H:%M:%S] ", localtime_r(&t, &buft)); va_start(args, format); g_vsnprintf(buf + LOG_TIME_LEN, BUFFSIZE, format, args); @@ -264,7 +264,7 @@ void log_warning(LogInstance instance, const gchar *format, ...) struct tm buft; time(&t); - strftime(buf, LOG_TIME_LEN + 1, "[%H:%M:%S] ", localtime_r(&t, &buft)); + strftime(buf, LOG_TIME_LEN + 1, "[%Y-%m-%d %H:%M:%S] ", localtime_r(&t, &buft)); va_start(args, format); g_vsnprintf(buf + LOG_TIME_LEN, BUFFSIZE, format, args); @@ -298,7 +298,7 @@ void log_error(LogInstance instance, const gchar *format, ...) struct tm buft; time(&t); - strftime(buf, LOG_TIME_LEN + 1, "[%H:%M:%S] ", localtime_r(&t, &buft)); + strftime(buf, LOG_TIME_LEN + 1, "[%Y-%m-%d %H:%M:%S] ", localtime_r(&t, &buft)); va_start(args, format); g_vsnprintf(buf + LOG_TIME_LEN, BUFFSIZE, format, args); @@ -332,7 +332,7 @@ void log_status_ok(LogInstance instance, const gchar *format, ...) struct tm buft; time(&t); - strftime(buf, LOG_TIME_LEN + 1, "[%H:%M:%S] ", localtime_r(&t, &buft)); + strftime(buf, LOG_TIME_LEN + 1, "[%Y-%m-%d %H:%M:%S] ", localtime_r(&t, &buft)); va_start(args, format); g_vsnprintf(buf + LOG_TIME_LEN, BUFFSIZE, format, args); @@ -366,7 +366,7 @@ void log_status_nok(LogInstance instance, const gchar *format, ...) struct tm buft; time(&t); - strftime(buf, LOG_TIME_LEN + 1, "[%H:%M:%S] ", localtime_r(&t, &buft)); + strftime(buf, LOG_TIME_LEN + 1, "[%Y-%m-%d %H:%M:%S] ", localtime_r(&t, &buft)); va_start(args, format); g_vsnprintf(buf + LOG_TIME_LEN, BUFFSIZE, format, args); @@ -400,7 +400,7 @@ void log_status_skip(LogInstance instance, const gchar *format, ...) struct tm buft; time(&t); - strftime(buf, LOG_TIME_LEN + 1, "[%H:%M:%S] ", localtime_r(&t, &buft)); + strftime(buf, LOG_TIME_LEN + 1, "[%Y-%m-%d %H:%M:%S] ", localtime_r(&t, &buft)); va_start(args, format); g_vsnprintf(buf + LOG_TIME_LEN, BUFFSIZE, format, args); diff --git a/src/common/log.h b/src/common/log.h index c48343b7d..f00e83708 100644 --- a/src/common/log.h +++ b/src/common/log.h @@ -29,7 +29,7 @@ #define LOG_APPEND_TEXT_HOOKLIST "log_append_text" #define DEBUG_FILTERING_APPEND_TEXT_HOOKLIST "debug_append_text" -#define LOG_TIME_LEN 11 +#define LOG_TIME_LEN 22 typedef enum {