diff --git a/src/api.c b/src/api.c index 853cfe06..15ee1778 100644 --- a/src/api.c +++ b/src/api.c @@ -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' */ diff --git a/src/log.c b/src/log.c index c3e1b026..e8b9c05c 100644 --- a/src/log.c +++ b/src/log.c @@ -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. diff --git a/src/log.h b/src/log.h index 515244df..3c056059 100644 --- a/src/log.h +++ b/src/log.h @@ -43,6 +43,7 @@ extern int _slup; /* INTERNAL: Is syslog up yet? */ +void log_toggle_debug(void); void logit (int prio, const char *fmt, ...); #endif /* FINIT_LOG_H_ */