Move log timestamp format string to a separate macro in log.h
authorAndrej Kacian <ticho@claws-mail.org>
Tue, 14 May 2019 14:15:10 +0000 (16:15 +0200)
committerAndrej Kacian <ticho@claws-mail.org>
Tue, 14 May 2019 14:16:49 +0000 (16:16 +0200)
src/common/log.c
src/common/log.h

index 1a399b8421cbe08f845f75a5d6b2a452824720b4..5540a894c6139756a3eb3c2e4e3ed6ae597fefb8 100644 (file)
@@ -199,7 +199,7 @@ void log_print(LogInstance instance, const gchar *format, ...)
        struct tm buft;
 
        time(&t);
-       strftime(buf, LOG_TIME_LEN + 1, "[%Y-%m-%d %H:%M:%S] ", localtime_r(&t, &buft));
+       strftime(buf, LOG_TIME_LEN + 1, LOG_TIME_FORMAT, 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, "[%Y-%m-%d %H:%M:%S] ", localtime_r(&t, &buft));
+       strftime(buf, LOG_TIME_LEN + 1, LOG_TIME_FORMAT, 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, "[%Y-%m-%d %H:%M:%S] ", localtime_r(&t, &buft));
+       strftime(buf, LOG_TIME_LEN + 1, LOG_TIME_FORMAT, 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, "[%Y-%m-%d %H:%M:%S] ", localtime_r(&t, &buft));
+       strftime(buf, LOG_TIME_LEN + 1, LOG_TIME_FORMAT, 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, "[%Y-%m-%d %H:%M:%S] ", localtime_r(&t, &buft));
+       strftime(buf, LOG_TIME_LEN + 1, LOG_TIME_FORMAT, 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, "[%Y-%m-%d %H:%M:%S] ", localtime_r(&t, &buft));
+       strftime(buf, LOG_TIME_LEN + 1, LOG_TIME_FORMAT, 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, "[%Y-%m-%d %H:%M:%S] ", localtime_r(&t, &buft));
+       strftime(buf, LOG_TIME_LEN + 1, LOG_TIME_FORMAT, localtime_r(&t, &buft));
 
        va_start(args, format);
        g_vsnprintf(buf + LOG_TIME_LEN, BUFFSIZE, format, args);
index f00e83708fc79abe3ba0b9ffea2a5c6d679fe0c8..64bd91ac09179e24a9f49a08d70c1806079b3ef8 100644 (file)
@@ -29,6 +29,7 @@
 #define LOG_APPEND_TEXT_HOOKLIST "log_append_text"
 #define DEBUG_FILTERING_APPEND_TEXT_HOOKLIST "debug_append_text"
 
+#define LOG_TIME_FORMAT "[%Y-%m-%d %H:%M:%S] "
 #define LOG_TIME_LEN 22
 
 typedef enum