From 5f493255eee3383581bf5db4cb63fa1935a6a88b Mon Sep 17 00:00:00 2001 From: John Date: Sun, 1 Oct 2023 22:31:50 +0200 Subject: [PATCH] prepare logging without timestamp --- src/lib/utils/log.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib/utils/log.cpp b/src/lib/utils/log.cpp index 9db2c46a..8601c8a7 100755 --- a/src/lib/utils/log.cpp +++ b/src/lib/utils/log.cpp @@ -212,6 +212,9 @@ void logWrite(const char* facility, const LogLevel level, const char* message, v syslog(s_syslogLevels[level], "[%s %s] %s", facility, s_levelNames[level], buf); } else { #endif +#ifdef LOG_WITHOUT_TIMEPREFIX + fprintf(s_logFile, "[%s %s] %s\n", +#else struct timespec ts; struct tm td; clockGettime(&ts); @@ -219,6 +222,7 @@ void logWrite(const char* facility, const LogLevel level, const char* message, v fprintf(s_logFile, "%04d-%02d-%02d %02d:%02d:%02d.%03ld [%s %s] %s\n", td.tm_year+1900, td.tm_mon+1, td.tm_mday, td.tm_hour, td.tm_min, td.tm_sec, ts.tv_nsec/1000000, +#endif facility, s_levelNames[level], buf); fflush(s_logFile); #ifdef HAVE_SYSLOG_H