4 LogLevel log_level = LogLevel::WARN;
5 bool log_to_console = true; // whether we should output log messages to console
9 void log(LogLevel lvl, const char *msg) noexcept
11 if (lvl >= log_level) {
13 std::cout << "dinit: " << msg << std::endl;
18 // Log a multi-part message beginning
19 void logMsgBegin(LogLevel lvl, const char *msg) noexcept
21 log_current_line = lvl >= log_level;
22 if (log_current_line) {
24 std::cout << "dinit: " << msg;
29 // Continue a multi-part log message
30 void logMsgPart(const char *msg) noexcept
32 if (log_current_line) {
39 // Complete a multi-part log message
40 void logMsgEnd(const char *msg) noexcept
42 if (log_current_line) {
44 std::cout << msg << std::endl;
49 void logServiceStarted(const char *service_name) noexcept
52 std::cout << "[ OK ] " << service_name << std::endl;
56 void logServiceFailed(const char *service_name) noexcept
59 std::cout << "[FAILED] " << service_name << std::endl;
63 void logServiceStopped(const char *service_name) noexcept
66 std::cout << "[STOPPED] " << service_name << std::endl;