mirror of
https://github.com/troglobit/finit.git
synced 2026-10-11 17:02:42 +07:00
Refactor, move debug toggle to log.c:log_toggle_debug()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
#include "cond.h"
|
||||
#include "conf.h"
|
||||
#include "helpers.h"
|
||||
#include "log.h"
|
||||
#include "plugin.h"
|
||||
#include "sig.h"
|
||||
#include "service.h"
|
||||
@@ -227,12 +228,7 @@ static void cb(uev_t *w, void *UNUSED(arg), int UNUSED(events))
|
||||
break;
|
||||
|
||||
case INIT_CMD_DEBUG:
|
||||
debug = !debug;
|
||||
if (debug)
|
||||
silent = 0;
|
||||
else
|
||||
silent = quiet ? 1 : SILENT_MODE;
|
||||
logit(LOG_INFO, "Debug mode %s", debug ? "enabled" : "disabled");
|
||||
log_toggle_debug();
|
||||
break;
|
||||
|
||||
case INIT_CMD_RELOAD: /* 'init q' and 'initctl reload' */
|
||||
|
||||
@@ -29,6 +29,16 @@
|
||||
#include "log.h"
|
||||
|
||||
|
||||
void log_toggle_debug(void)
|
||||
{
|
||||
debug = !debug;
|
||||
if (debug)
|
||||
silent = 0;
|
||||
else
|
||||
silent = quiet ? 1 : SILENT_MODE;
|
||||
logit(LOG_INFO, "Debug mode %s", debug ? "enabled" : "disabled");
|
||||
}
|
||||
|
||||
/*
|
||||
* Log to /dev/kmsg until syslogd has started, then openlog()
|
||||
* and continue logging as a regular daemon.
|
||||
|
||||
Reference in New Issue
Block a user