auto sd_type = static_cast<ShutdownType>(rbuf[1]);
service_set->stop_all_services(sd_type);
- log_to_console = true;
+ enable_console_log(true);
char ackBuf[] = { DINIT_RP_ACK };
if (! queuePacket(ackBuf, 1)) return;
#include "dinit-log.h"
LogLevel log_level = LogLevel::WARN;
-bool log_to_console = true; // whether we should output log messages to console
-bool log_current_line;
+static bool log_to_console = true; // whether we should output log messages to
+ // console immediately
+static bool log_current_line; // Whether the current line is being logged
+
+void enable_console_log(bool enable) noexcept
+{
+ log_to_console = enable;
+}
// Log a message
void log(LogLevel lvl, const char *msg) noexcept
};
extern LogLevel log_level;
-extern bool log_to_console;
+void enable_console_log(bool do_enable) noexcept;
void log(LogLevel lvl, const char *msg) noexcept;
void logMsgBegin(LogLevel lvl, const char *msg) noexcept;
/* handle SIGINT signal (generated by kernel when ctrl+alt+del pressed) */
static void sigint_reboot_cb(struct ev_loop *loop, ev_signal *w, int revents)
{
- log_to_console = true;
+ enable_console_log(true);
service_set->stop_all_services(ShutdownType::REBOOT);
}
/* handle SIGTERM/SIGQUIT - stop all services (not used for system daemon) */
static void sigterm_cb(struct ev_loop *loop, ev_signal *w, int revents)
{
- log_to_console = true;
+ enable_console_log(true);
service_set->stop_all_services();
}
releaseConsole();
}
else if (startCheckDependencies(false)) {
- log_to_console = false;
+ enable_console_log(false);
allDepsStarted(true);
}
else {
void ServiceRecord::releaseConsole() noexcept
{
- log_to_console = true;
+ enable_console_log(true);
if (next_for_console != nullptr) {
next_for_console->acquiredConsole();
}