From ae3c354e844698bdb4ed35a6845aa9dca1e9205f Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Fri, 4 Apr 2014 13:05:18 +0800 Subject: log: Allow runtime selection of 'debug' log level Currently, we need to compile with -DDEBUG to implement debug-level logging in the UIs and discover server. Since we may not be able to easily replace a system's petitboot binaries, this change introduces a -v|--verbose option to the discver server and ncurses UI, which enables debug at runtime. We also move some of the udev debug code out of an #ifdef DEBUG block. Since petitboot is generally started on boot, we also add a little infrastructure to pass -v to petitboot on certain system contitions: either petitboot.debug on the kernel command line, or a petitboot,debug? NVRAM property containing the value 'true'. Signed-off-by: Jeremy Kerr --- lib/log/log.c | 5 +++++ lib/log/log.h | 1 + 2 files changed, 6 insertions(+) (limited to 'lib/log') diff --git a/lib/log/log.c b/lib/log/log.c index a4f5c22..44543d0 100644 --- a/lib/log/log.c +++ b/lib/log/log.c @@ -41,6 +41,11 @@ void __pb_log_init(FILE *fp, bool _debug) debug = _debug; } +void pb_log_set_debug(bool _debug) +{ + debug = _debug; +} + FILE *pb_log_get_stream(void) { static FILE *null_stream; diff --git a/lib/log/log.h b/lib/log/log.h index e34de33..9454596 100644 --- a/lib/log/log.h +++ b/lib/log/log.h @@ -15,6 +15,7 @@ void __pb_log_init(FILE *stream, bool debug); #define pb_log_init(s) __pb_log_init(s, false) #endif +void pb_log_set_debug(bool debug); FILE *pb_log_get_stream(void); #endif /* _LOG_H */ -- cgit v1.2.1