diff options
author | Danny Holman <dholman@gymli.org> | 2023-10-02 13:18:39 -0500 |
---|---|---|
committer | Danny Holman <dholman@gymli.org> | 2023-10-02 13:18:39 -0500 |
commit | 3137deb496e4bfa80d55d33c81b54d7a7a3c4cee (patch) | |
tree | f84537bec95a53b8d4c0263546df8bd7f5972856 /server/src/logging.c | |
parent | 6da8a92517a093372e928b63f41927ff417284ca (diff) |
server: log function should also write to stderr
The logging API should write to both the specified file handle and
stderr. This allows the init system (if there is one in use) to also
write messages to its internal buffer.
Signed-off-by: Danny Holman <dholman@gymli.org>
Diffstat (limited to 'server/src/logging.c')
-rw-r--r-- | server/src/logging.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/server/src/logging.c b/server/src/logging.c index e295116..6adaf51 100644 --- a/server/src/logging.c +++ b/server/src/logging.c @@ -26,12 +26,12 @@ int vlog_msg(int level, const char *fmt, va_list args) { case LOG_SEVERE: snprintf(output, 1024, "%s %s: %s", timestr, severe, fmt); ret = vfprintf(out_stream, output, args); - vfprintf(stderr, output, args); + vfprintf(out_stream, output, args); break; case LOG_WARNING: snprintf(output, 1024, "%s %s: %s", timestr, warn, fmt); ret = vfprintf(out_stream, output, args); - vfprintf(stderr, output, args); + vfprintf(out_stream, output, args); break; case LOG_INFO: snprintf(output, 1024, "%s %s: %s", timestr, info, fmt); @@ -54,6 +54,10 @@ int log_msg(int level, const char *fmt, ...) { done = vlog_msg(level, fmt, args); va_end(args); + va_start(args, fmt); + done = vfprintf(stderr, fmt, args); + va_end(args); + return done; } |