From dcda82318f858b29a22e9f9df9e732b94f7456dd Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 24 May 2020 13:41:04 +0100 Subject: [PATCH] log: Set log level for early logging Unless ->level is set, logging is just a no-op. We must set this twice, because the system log is used to report command line parsing errors, but the command line might increase the log level. Signed-off-by: Ian Jackson --- log.c | 5 +++++ secnet.c | 1 + secnet.h | 1 + 3 files changed, 7 insertions(+) diff --git a/log.c b/log.c index f937d2e..1ff2e5c 100644 --- a/log.c +++ b/log.c @@ -659,9 +659,14 @@ void log_from_fd(int fd, cstring_t prefix, struct log_if *log) } static struct logfile startup_log; +void log_early_setlevel(void) +{ + startup_log.level=message_level; +} void log_early_init(void) { logfile_file_init(&startup_log,stderr,"startup"); + log_early_setlevel(); system_log=&startup_log.ops;; } diff --git a/secnet.c b/secnet.c index 2ebcddc..08505b0 100644 --- a/secnet.c +++ b/secnet.c @@ -500,6 +500,7 @@ int main(int argc, char **argv) enter_phase(PHASE_GETOPTS); parse_options(argc,argv); + log_early_setlevel(); enter_phase(PHASE_READCONFIG); config=read_conffile(configfile); diff --git a/secnet.h b/secnet.h index fd4b48f..b54df22 100644 --- a/secnet.h +++ b/secnet.h @@ -654,6 +654,7 @@ static inline void cfgfile_log_init(struct cfgfile_log *cfl, } void log_early_init(void); +void log_early_setlevel(void); /* SITE interface */ -- 2.30.2