Route all logging through a function pointer

Prepare for a second logging function that logs to syslog.
This commit is contained in:
Beat Bolli 2020-01-29 00:07:00 +01:00
parent e4f8c9f8f4
commit 5b7dc86a47

View File

@ -57,8 +57,10 @@ static enum loglevel {
log_debug log_debug
} loglevel = log_none; } loglevel = log_none;
static void (*logmsg)(enum loglevel level, const char *, ...);
static void static void
logmsg(enum loglevel level, const char *format, ...) logstdio(enum loglevel level, const char *format, ...)
{ {
if (loglevel >= level) { if (loglevel >= level) {
int save = errno; int save = errno;
@ -605,6 +607,7 @@ sendline(struct client *client, int max_line_length, unsigned long *rng)
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
logmsg = logstdio;
struct config config = CONFIG_DEFAULT; struct config config = CONFIG_DEFAULT;
const char *config_file = DEFAULT_CONFIG_FILE; const char *config_file = DEFAULT_CONFIG_FILE;