mirror of
https://github.com/troglobit/finit.git
synced 2026-10-15 10:29:35 +00:00
Fix initctl debug toggle regression introduced in ae09272b
Calling `initctl debug` is supposed to toggle Finit debug messages on
the boot console. This broke in ae09272b when improving support for
running Finit in containers.
Part of this change is a slight refactor of who calles log_init() when
starting up, and when to call ttinit(). We now call ttinit() every time
we toggle debug.
Also, toggling back to normal logging had a bug. The new default log
level for Finit is LOG_INFO, but toggling back set it to LOG_NOTICE.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
3d91112e0d
commit
01cb088e51
4 files changed
+14
-13
No files matched your search
@@ -40,6 +40,8 @@ static int loglevel = LOG_INFO;
|
||||
|
||||
void log_init(void)
|
||||
{
|
||||
ttinit();
|
||||
|
||||
if (debug)
|
||||
loglevel = LOG_DEBUG;
|
||||
else
|
||||
@@ -72,24 +74,25 @@ static int log_open(void)
|
||||
if (debug)
|
||||
opts |= LOG_PERROR;
|
||||
|
||||
closelog();
|
||||
openlog("finit", opts, LOG_DAEMON);
|
||||
setlogmask(LOG_UPTO(loglevel));
|
||||
|
||||
return up = 1;
|
||||
}
|
||||
|
||||
static void log_close(void)
|
||||
{
|
||||
closelog();
|
||||
up = 0;
|
||||
}
|
||||
|
||||
/* Toggle debug mode */
|
||||
void log_debug(void)
|
||||
{
|
||||
debug = !debug;
|
||||
|
||||
if (debug) {
|
||||
loglevel = LOG_DEBUG;
|
||||
} else {
|
||||
loglevel = LOG_NOTICE;
|
||||
ttinit();
|
||||
}
|
||||
log_close();
|
||||
log_init();
|
||||
log_open();
|
||||
|
||||
logit(LOG_NOTICE, "Debug mode %s", debug ? "enabled" : "disabled");
|
||||
|
||||
Reference in new issue
Block a user