From 3cbcda088666ed60763a41a3416f8e0607f00777 Mon Sep 17 00:00:00 2001 From: Amy Gale Ruth Bowersox Date: Sat, 7 Dec 2019 19:44:48 -0700 Subject: [PATCH] fixed logging errorx --- src/log.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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)