diff --git a/src/log.c b/src/log.c index e6ab3c6..3035f88 100644 --- a/src/log.c +++ b/src/log.c @@ -7,7 +7,7 @@ /* string equivalents to the severity values */ static const char *severities[] = { "FATAL", "ERROR", "WARN ", "INFO ", "DEBUG" }; -static FILE *logfile = stdout; /* log file pointer */ +static FILE *logfile = NULL; /* log file pointer */ void Log(int level, const char *format, ...) { @@ -24,7 +24,7 @@ void Log(int level, const char *format, ...) gettimeofday(&tv, NULL); localtime_r(&(tv.tv_sec), &tm); strftime(timestamp, 32, "%F %T", &tm); - fprintf(logfile, "%s.%06u %s %s\n", timestamp, tv.tv_usec, severities[level], buf); + fprintf(logfile ? logfile : stdout, "%s.%06u %s %s\n", timestamp, tv.tv_usec, severities[level], buf); } void Log_assert_failed(const char *test, const char *file, int line)