prepare logging without timestamp
This commit is contained in:
@@ -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);
|
syslog(s_syslogLevels[level], "[%s %s] %s", facility, s_levelNames[level], buf);
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef LOG_WITHOUT_TIMEPREFIX
|
||||||
|
fprintf(s_logFile, "[%s %s] %s\n",
|
||||||
|
#else
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
struct tm td;
|
struct tm td;
|
||||||
clockGettime(&ts);
|
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",
|
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_year+1900, td.tm_mon+1, td.tm_mday,
|
||||||
td.tm_hour, td.tm_min, td.tm_sec, ts.tv_nsec/1000000,
|
td.tm_hour, td.tm_min, td.tm_sec, ts.tv_nsec/1000000,
|
||||||
|
#endif
|
||||||
facility, s_levelNames[level], buf);
|
facility, s_levelNames[level], buf);
|
||||||
fflush(s_logFile);
|
fflush(s_logFile);
|
||||||
#ifdef HAVE_SYSLOG_H
|
#ifdef HAVE_SYSLOG_H
|
||||||
|
|||||||
Reference in New Issue
Block a user