diff --git a/client/snapClient.cpp b/client/snapClient.cpp index 3ce8b132..d4e47e2f 100644 --- a/client/snapClient.cpp +++ b/client/snapClient.cpp @@ -157,8 +157,8 @@ int main (int argc, char **argv) Log::init( { - make_shared(debugSwitch.isSet()?(LogPriority::debug):(LogPriority::info), LogSink::Type::all, debugSwitch.isSet()?"%Y-%m-%d %H-%M-%S.#ms [#prio] (#tag)":"%Y-%m-%d %H-%M-%S [#prio]"), - make_shared("snapclient", LogPriority::debug, LogSink::Type::special) + make_shared(debugSwitch.isSet()?(LogSeverity::trace):(LogSeverity::info), LogSink::Type::all, debugSwitch.isSet()?"%Y-%m-%d %H-%M-%S.#ms [#prio] (#tag)":"%Y-%m-%d %H-%M-%S [#prio]"), + make_shared("snapclient", LogSeverity::trace, LogSink::Type::special) } ); diff --git a/common/log.h b/common/log.h index 50dd270c..8f07bda8 100644 --- a/common/log.h +++ b/common/log.h @@ -3,7 +3,7 @@ / _\ ( )( \/ )( ) / \ / __) / \ )( ) ( / (_/\( O )( (_ \ \_/\_/(__)(_/\_)\____/ \__/ \___/ - version 0.6.0 + version 0.7.0 https://github.com/badaix/aixlog This file is part of aixlog @@ -32,6 +32,10 @@ #ifndef AIX_LOG_HPP #define AIX_LOG_HPP +#ifndef _WIN32 +#define _HAS_SYSLOG_ +#endif + #include #include #include @@ -48,17 +52,18 @@ #endif #ifdef _WIN32 #include -#else +#endif +#ifdef _HAS_SYSLOG_ #include #endif /// Internal helper defines -#define LOG_WO_TAG(P) std::clog << (LogPriority)P << Tag(__func__) << LogType::normal -#define SLOG_WO_TAG(P) std::clog << (LogPriority)P << Tag(__func__) << LogType::special +#define LOG_WO_TAG(P) std::clog << (LogSeverity)P << Tag(__func__) << LogType::normal +#define SLOG_WO_TAG(P) std::clog << (LogSeverity)P << Tag(__func__) << LogType::special -#define LOG_TAG(P, T) std::clog << (LogPriority)P << Tag(T) << LogType::normal -#define SLOG_TAG(P, T) std::clog << (LogPriority)P << Tag(T) << LogType::special +#define LOG_TAG(P, T) std::clog << (LogSeverity)P << Tag(T) << LogType::normal +#define SLOG_TAG(P, T) std::clog << (LogSeverity)P << Tag(T) << LogType::special #define LOG_X(x,P,T,FUNC, ...) FUNC #define SLOG_X(x,P,T,FUNC, ...) FUNC @@ -80,37 +85,51 @@ enum class LogType }; -enum Priority +enum Severity { - EMERG = 0, // 0 system is unusable - ALERT = 1, // 1 action must be taken immediately - CRIT = 2, // 2 critical conditions - ERROR = 3, // 3 error conditions - WARNING = 4, // 4 warning conditions - NOTICE = 5, // 5 normal, but significant, condition - INFO = 6, // 6 informational message - DEBUG = 7 // 7 debug-level message +// https://chromium.googlesource.com/chromium/mini_chromium/+/master/base/logging.cc + +// Aixlog Boost Syslog Android macOS Syslog Desc +// +// UNKNOWN +// DEFAULT +// trace trace VERBOSE +// debug debug DEBUG DEBUG DEBUG debug-level message +// info info INFO INFO INFO informational message +// notice NOTICE normal, but significant, condition +// warning warning WARNING WARN DEFAULT warning conditions +// error error ERROR ERROR ERROR error conditions +// fatal fatal CRIT FATAL FAULT critical conditions +// ALERT action must be taken immediately +// EMERG system is unusable + + TRACE = 0, + DEBUG = 1, + INFO = 2, + NOTICE = 3, + WARNING = 4, + ERROR = 5, + FATAL = 6 }; -enum class LogPriority : std::int8_t +enum class LogSeverity : std::int8_t { - emerg = EMERG, - alert = ALERT, - critical= CRIT, - error = ERROR, - warning = WARNING, - notice = NOTICE, + trace = TRACE, + debug = DEBUG, info = INFO, - debug = DEBUG + notice = NOTICE, + warning = WARNING, + error = ERROR, + fatal = FATAL }; enum class Color { - none = 0, - black = 1, + none = 0, + black = 1, red = 2, green = 3, yellow = 4, @@ -199,7 +218,7 @@ struct LogSink all }; - LogSink(LogPriority priority, Type type) : priority(priority), sink_type_(type) + LogSink(LogSeverity severity, Type type) : severity(severity), sink_type_(type) { } @@ -207,7 +226,7 @@ struct LogSink { } - virtual void log(const time_point_sys_clock& timestamp, LogPriority priority, LogType type, const Tag& tag, const std::string& message) const = 0; + virtual void log(const time_point_sys_clock& timestamp, LogSeverity severity, LogType type, const Tag& tag, const std::string& message) const = 0; virtual Type get_type() const { return sink_type_; @@ -219,7 +238,7 @@ struct LogSink return *this; } - LogPriority priority; + LogSeverity severity; protected: Type sink_type_; @@ -227,7 +246,7 @@ protected: -static std::ostream& operator<< (std::ostream& os, const LogPriority& log_priority); +static std::ostream& operator<< (std::ostream& os, const LogSeverity& log_severity); static std::ostream& operator<< (std::ostream& os, const LogType& log_type); static std::ostream& operator<< (std::ostream& os, const Tag& tag); static std::ostream& operator<< (std::ostream& os, const Conditional& conditional); @@ -263,29 +282,27 @@ public: logSinks.erase(std::remove(logSinks.begin(), logSinks.end(), sink), logSinks.end()); } - static std::string toString(LogPriority logPriority) + static std::string toString(LogSeverity logSeverity) { - switch (logPriority) + switch (logSeverity) { - case LogPriority::emerg: - return "Emerg"; - case LogPriority::alert: - return "Alert"; - case LogPriority::critical: - return "Crit"; - case LogPriority::error: - return "Err"; - case LogPriority::warning: - return "Warn"; - case LogPriority::notice: - return "Notice"; - case LogPriority::info: - return "Info"; - case LogPriority::debug: + case LogSeverity::trace: + return "Trace"; + case LogSeverity::debug: return "Debug"; + case LogSeverity::info: + return "Info"; + case LogSeverity::notice: + return "Notice"; + case LogSeverity::warning: + return "Warn"; + case LogSeverity::error: + return "Err"; + case LogSeverity::fatal: + return "Fatal"; default: std::stringstream ss; - ss << logPriority; + ss << logSeverity; return ss.str(); } } @@ -310,13 +327,13 @@ protected: ((type_ == LogType::special) && (sink->get_type() == LogSink::Type::special)) || ((type_ == LogType::normal) && (sink->get_type() == LogSink::Type::normal)) ) - if (priority_ <= sink->priority) - sink->log(now, priority_, type_, tag_, buffer_.str()); + if (severity_ >= sink->severity) + sink->log(now, severity_, type_, tag_, buffer_.str()); } } buffer_.str(""); buffer_.clear(); - //priority_ = debug; // default to debug for each message + //severity_ = debug; // default to debug for each message //type_ = kNormal; tag_ = nullptr; conditional_.set(true); @@ -327,8 +344,8 @@ protected: int overflow(int c) { /* if ( - (priority_ > loglevel_) && - ((type_ == kNormal) || !syslog_enabled_) // || (syslogpriority_ > loglevel_)) + (severity_ > loglevel_) && + ((type_ == kNormal) || !syslog_enabled_) // || (syslogseverity_ > loglevel_)) ) return c; */ if (c != EOF) @@ -348,13 +365,13 @@ protected: private: - friend std::ostream& operator<< (std::ostream& os, const LogPriority& log_priority); + friend std::ostream& operator<< (std::ostream& os, const LogSeverity& log_severity); friend std::ostream& operator<< (std::ostream& os, const LogType& log_type); friend std::ostream& operator<< (std::ostream& os, const Tag& tag); friend std::ostream& operator<< (std::ostream& os, const Conditional& conditional); std::stringstream buffer_; - LogPriority priority_; + LogSeverity severity_; LogType type_; Tag tag_; Conditional conditional_; @@ -365,8 +382,8 @@ private: struct LogSinkFormat : public LogSink { - LogSinkFormat(LogPriority priority, Type type, const std::string& format = "%Y-%m-%d %H-%M-%S [#prio] (#tag)") : // #logline") : - LogSink(priority, type), + LogSinkFormat(LogSeverity severity, Type type, const std::string& format = "%Y-%m-%d %H-%M-%S [#prio] (#tag)") : // #logline") : + LogSink(severity, type), format_(format) { } @@ -376,12 +393,12 @@ struct LogSinkFormat : public LogSink format_ = format; } - virtual void log(const time_point_sys_clock& timestamp, LogPriority priority, LogType type, const Tag& tag, const std::string& message) const = 0; + virtual void log(const time_point_sys_clock& timestamp, LogSeverity severity, LogType type, const Tag& tag, const std::string& message) const = 0; protected: /// strftime format + proprietary "#ms" for milliseconds - virtual void do_log(std::ostream& stream, const time_point_sys_clock& timestamp, LogPriority priority, LogType type, const Tag& tag, const std::string& message) const + virtual void do_log(std::ostream& stream, const time_point_sys_clock& timestamp, LogSeverity severity, LogType type, const Tag& tag, const std::string& message) const { std::time_t now_c = std::chrono::system_clock::to_time_t(timestamp); struct::tm now_tm = *std::localtime(&now_c); @@ -400,7 +417,7 @@ protected: pos = result.find("#prio"); if (pos != std::string::npos) - result.replace(pos, 5, Log::toString(priority)); + result.replace(pos, 5, Log::toString(severity)); pos = result.find("#tag"); @@ -429,15 +446,15 @@ protected: struct LogSinkCout : public LogSinkFormat { - LogSinkCout(LogPriority priority, Type type, const std::string& format = "%Y-%m-%d %H-%M-%S.#ms [#prio] (#tag)") : // #logline") : - LogSinkFormat(priority, type, format) + LogSinkCout(LogSeverity severity, Type type, const std::string& format = "%Y-%m-%d %H-%M-%S.#ms [#prio] (#tag)") : // #logline") : + LogSinkFormat(severity, type, format) { } - virtual void log(const time_point_sys_clock& timestamp, LogPriority priority, LogType type, const Tag& tag, const std::string& message) const + virtual void log(const time_point_sys_clock& timestamp, LogSeverity severity, LogType type, const Tag& tag, const std::string& message) const { - if (priority <= this->priority) - do_log(std::cout, timestamp, priority, type, tag, message); + if (severity >= this->severity) + do_log(std::cout, timestamp, severity, type, tag, message); } }; @@ -445,15 +462,15 @@ struct LogSinkCout : public LogSinkFormat struct LogSinkCerr : public LogSinkFormat { - LogSinkCerr(LogPriority priority, Type type, const std::string& format = "%Y-%m-%d %H-%M-%S.#ms [#prio] (#tag)") : // #logline") : - LogSinkFormat(priority, type, format) + LogSinkCerr(LogSeverity severity, Type type, const std::string& format = "%Y-%m-%d %H-%M-%S.#ms [#prio] (#tag)") : // #logline") : + LogSinkFormat(severity, type, format) { } - virtual void log(const time_point_sys_clock& timestamp, LogPriority priority, LogType type, const Tag& tag, const std::string& message) const + virtual void log(const time_point_sys_clock& timestamp, LogSeverity severity, LogType type, const Tag& tag, const std::string& message) const { - if (priority <= this->priority) - do_log(std::cerr, timestamp, priority, type, tag, message); + if (severity >= this->severity) + do_log(std::cerr, timestamp, severity, type, tag, message); } }; @@ -462,11 +479,11 @@ struct LogSinkCerr : public LogSinkFormat /// Not tested due to unavailability of Windows struct LogSinkOutputDebugString : LogSink { - LogSinkOutputDebugString(LogPriority priority, Type type = Type::all, const std::string& default_tag = "") : LogSink(priority, type) + LogSinkOutputDebugString(LogSeverity severity, Type type = Type::all, const std::string& default_tag = "") : LogSink(severity, type) { } - virtual void log(const time_point_sys_clock& timestamp, LogPriority priority, LogType type, const Tag& tag, const std::string& message) const + virtual void log(const time_point_sys_clock& timestamp, LogSeverity severity, LogType type, const Tag& tag, const std::string& message) const { #ifdef _WIN32 OutputDebugString(message.c_str()); @@ -478,38 +495,38 @@ struct LogSinkOutputDebugString : LogSink struct LogSinkUnifiedLogging : LogSink { - LogSinkUnifiedLogging(LogPriority priority, Type type = Type::all) : LogSink(priority, type) + LogSinkUnifiedLogging(LogSeverity severity, Type type = Type::all) : LogSink(severity, type) { } #ifdef __APPLE__ - os_log_type_t get_os_log_type(LogPriority priority) const + os_log_type_t get_os_log_type(LogSeverity severity) const { - switch (priority) + // https://developer.apple.com/documentation/os/os_log_type_t?language=objc + switch (severity) { - case LogPriority::emerg: - case LogPriority::alert: - case LogPriority::critical: - return OS_LOG_TYPE_FAULT; - case LogPriority::error: - return OS_LOG_TYPE_ERROR; - case LogPriority::warning: - case LogPriority::notice: - return OS_LOG_TYPE_DEFAULT; - case LogPriority::info: - return OS_LOG_TYPE_INFO; - case LogPriority::debug: + case LogSeverity::trace: + case LogSeverity::debug: return OS_LOG_TYPE_DEBUG; + case LogSeverity::info: + case LogSeverity::notice: + return OS_LOG_TYPE_INFO; + case LogSeverity::warning: + return OS_LOG_TYPE_DEFAULT; + case LogSeverity::error: + return OS_LOG_TYPE_ERROR; + case LogSeverity::fatal: + return OS_LOG_TYPE_FAULT; default: return OS_LOG_TYPE_DEFAULT; } } #endif - virtual void log(const time_point_sys_clock& timestamp, LogPriority priority, LogType type, const Tag& tag, const std::string& message) const + virtual void log(const time_point_sys_clock& timestamp, LogSeverity severity, LogType type, const Tag& tag, const std::string& message) const { #ifdef __APPLE__ - os_log_with_type(OS_LOG_DEFAULT, get_os_log_type(priority), "%{public}s", message.c_str()); + os_log_with_type(OS_LOG_DEFAULT, get_os_log_type(severity), "%{public}s", message.c_str()); #endif } }; @@ -518,9 +535,9 @@ struct LogSinkUnifiedLogging : LogSink struct LogSinkSyslog : public LogSink { - LogSinkSyslog(const char* ident, LogPriority priority, Type type) : LogSink(priority, type) + LogSinkSyslog(const char* ident, LogSeverity severity, Type type) : LogSink(severity, type) { -#ifndef _WIN32 +#ifdef _HAS_SYSLOG_ openlog(ident, LOG_PID, LOG_USER); #endif } @@ -530,10 +547,36 @@ struct LogSinkSyslog : public LogSink closelog(); } - virtual void log(const time_point_sys_clock& timestamp, LogPriority priority, LogType type, const Tag& tag, const std::string& message) const +#ifdef _HAS_SYSLOG_ + int get_syslog_priority(LogSeverity severity) const { -#ifndef _WIN32 - syslog((int)priority, "%s", message.c_str()); + // http://unix.superglobalmegacorp.com/Net2/newsrc/sys/syslog.h.html + switch (severity) + { + case LogSeverity::trace: + case LogSeverity::debug: + return LOG_DEBUG; + case LogSeverity::info: + return LOG_INFO; + case LogSeverity::notice: + return LOG_NOTICE; + case LogSeverity::warning: + return LOG_WARNING; + case LogSeverity::error: + return LOG_ERR; + case LogSeverity::fatal: + return LOG_CRIT; + default: + return LOG_INFO; + } + } +#endif + + + virtual void log(const time_point_sys_clock& timestamp, LogSeverity severity, LogType type, const Tag& tag, const std::string& message) const + { +#ifdef _HAS_SYSLOG_ + syslog(get_syslog_priority(severity), "%s", message.c_str()); #endif } }; @@ -542,36 +585,36 @@ struct LogSinkSyslog : public LogSink struct LogSinkAndroid : public LogSink { - LogSinkAndroid(const std::string& ident, LogPriority priority, Type type = Type::all) : LogSink(priority, type), ident_(ident) + LogSinkAndroid(const std::string& ident, LogSeverity severity, Type type = Type::all) : LogSink(severity, type), ident_(ident) { } #ifdef __ANDROID__ - android_LogPriority get_android_prio(LogPriority priority) const + android_LogSeverity get_android_prio(LogSeverity severity) const { - switch (priority) + // https://developer.android.com/ndk/reference/log_8h.html + switch (severity) { - case LogPriority::emerg: - case LogPriority::alert: - case LogPriority::critical: - return ANDROID_LOG_FATAL; - case LogPriority::error: - return ANDROID_LOG_ERROR; - case LogPriority::warning: - return ANDROID_LOG_WARN; - case LogPriority::notice: - return ANDROID_LOG_DEFAULT; - case LogPriority::info: - return ANDROID_LOG_INFO; - case LogPriority::debug: + case LogSeverity::trace: + return ANDROID_LOG_VERBOSE; + case LogSeverity::debug: return ANDROID_LOG_DEBUG; + case LogSeverity::info: + case LogSeverity::notice: + return ANDROID_LOG_INFO; + case LogSeverity::warning: + return ANDROID_LOG_WARN; + case LogSeverity::error: + return ANDROID_LOG_ERROR; + case LogSeverity::fatal: + return ANDROID_LOG_FATAL; default: return ANDROID_LOG_UNKNOWN; } } #endif - virtual void log(const time_point_sys_clock& timestamp, LogPriority priority, LogType type, const Tag& tag, const std::string& message) const + virtual void log(const time_point_sys_clock& timestamp, LogSeverity severity, LogType type, const Tag& tag, const std::string& message) const { #ifdef __ANDROID__ std::string log_tag;// = default_tag_; @@ -585,7 +628,7 @@ struct LogSinkAndroid : public LogSink else log_tag = ident_; - __android_log_write(get_android_prio(priority), log_tag.c_str(), message.c_str()); + __android_log_write(get_android_prio(severity), log_tag.c_str(), message.c_str()); #endif } @@ -598,7 +641,7 @@ protected: /// Not tested due to unavailability of Windows struct LogSinkEventLog : public LogSink { - LogSinkEventLog(const std::string& ident, LogPriority priority, Type type = Type::all) : LogSink(priority, type) + LogSinkEventLog(const std::string& ident, LogSeverity severity, Type type = Type::all) : LogSink(severity, type) { #ifdef _WIN32 event_log = RegisterEventSource(NULL, ident.c_str()); @@ -606,32 +649,32 @@ struct LogSinkEventLog : public LogSink } #ifdef _WIN32 - WORD get_type(LogPriority priority) const + WORD get_type(LogSeverity severity) const { - switch (priority) + // https://msdn.microsoft.com/de-de/library/windows/desktop/aa363679(v=vs.85).aspx + switch (severity) { - case LogPriority::emerg: - case LogPriority::alert: - case LogPriority::critical: - case LogPriority::error: - return EVENTLOG_ERROR_TYPE; - case LogPriority::warning: - return EVENTLOG_WARNING_TYPE; - case LogPriority::notice: - return EVENTLOG_SUCCESS; - case LogPriority::info: - case LogPriority::debug: + case LogSeverity::trace: + case LogSeverity::debug: return EVENTLOG_INFORMATION_TYPE; + case LogSeverity::info: + case LogSeverity::notice: + return EVENTLOG_SUCCESS; + case LogSeverity::warning: + return EVENTLOG_WARNING_TYPE; + case LogSeverity::error: + case LogSeverity::fatal: + return EVENTLOG_ERROR_TYPE; default: return EVENTLOG_INFORMATION_TYPE; } } #endif - virtual void log(const time_point_sys_clock& timestamp, LogPriority priority, LogType type, const Tag& tag, const std::string& message) const + virtual void log(const time_point_sys_clock& timestamp, LogSeverity severity, LogType type, const Tag& tag, const std::string& message) const { #ifdef _WIN32 - ReportEvent(event_log, get_type(priority), 0, 0, NULL, 1, 0, &message.c_str(), NULL); + ReportEvent(event_log, get_type(severity), 0, 0, NULL, 1, 0, &message.c_str(), NULL); #endif } @@ -645,26 +688,26 @@ protected: struct LogSinkNative : public LogSink { - LogSinkNative(const std::string& ident, LogPriority priority, Type type = Type::all) : - LogSink(priority, type), + LogSinkNative(const std::string& ident, LogSeverity severity, Type type = Type::all) : + LogSink(severity, type), log_sink_(nullptr), ident_(ident) { #ifdef __ANDROID__ - log_sink_ = std::make_shared(ident_, priority, type); + log_sink_ = std::make_shared(ident_, severity, type); #elif __APPLE__ - log_sink_ = std::make_shared(priority, type); + log_sink_ = std::make_shared(severity, type); #elif _WIN32 - log_sink_ = std::make_shared(priority, type); + log_sink_ = std::make_shared(severity, type); #else - log_sink_ = std::make_shared(ident_.c_str(), priority, type); + log_sink_ = std::make_shared(ident_.c_str(), severity, type); #endif } - virtual void log(const time_point_sys_clock& timestamp, LogPriority priority, LogType type, const Tag& tag, const std::string& message) const + virtual void log(const time_point_sys_clock& timestamp, LogSeverity severity, LogType type, const Tag& tag, const std::string& message) const { if (log_sink_) - log_sink_->log(timestamp, priority, type, tag, message); + log_sink_->log(timestamp, severity, type, tag, message); } protected: @@ -676,16 +719,16 @@ protected: struct LogSinkCallback : public LogSink { - typedef std::function callback_fun; + typedef std::function callback_fun; - LogSinkCallback(LogPriority priority, Type type, callback_fun callback) : LogSink(priority, type), callback(callback) + LogSinkCallback(LogSeverity severity, Type type, callback_fun callback) : LogSink(severity, type), callback(callback) { } - virtual void log(const time_point_sys_clock& timestamp, LogPriority priority, LogType type, const Tag& tag, const std::string& message) const + virtual void log(const time_point_sys_clock& timestamp, LogSeverity severity, LogType type, const Tag& tag, const std::string& message) const { - if (callback && (priority <= this->priority)) - callback(timestamp, priority, type, tag, message); + if (callback && (severity >= this->severity)) + callback(timestamp, severity, type, tag, message); } private: @@ -694,13 +737,13 @@ private: -static std::ostream& operator<< (std::ostream& os, const LogPriority& log_priority) +static std::ostream& operator<< (std::ostream& os, const LogSeverity& log_severity) { Log* log = dynamic_cast(os.rdbuf()); - if (log && (log->priority_ != log_priority)) + if (log && (log->severity_ != log_severity)) { log->sync(); - log->priority_ = log_priority; + log->severity_ = log_severity; } return os; } @@ -739,19 +782,19 @@ static std::ostream& operator<< (std::ostream& os, const Conditional& conditiona static std::ostream& operator<< (std::ostream& os, const LogColor& log_color) { - os << "\033["; - if ((log_color.foreground == Color::none) && (log_color.background == Color::none)) - os << "0"; // reset colors if no params + os << "\033["; + if ((log_color.foreground == Color::none) && (log_color.background == Color::none)) + os << "0"; // reset colors if no params - if (log_color.foreground != Color::none) + if (log_color.foreground != Color::none) { - os << 29 + (int)log_color.foreground; - if (log_color.background != Color::none) + os << 29 + (int)log_color.foreground; + if (log_color.background != Color::none) os << ";"; - } - if (log_color.background != Color::none) - os << 39 + (int)log_color.background; - os << "m"; + } + if (log_color.background != Color::none) + os << 39 + (int)log_color.background; + os << "m"; return os; } @@ -760,7 +803,7 @@ static std::ostream& operator<< (std::ostream& os, const LogColor& log_color) static std::ostream& operator<< (std::ostream& os, const Color& color) { - os << LogColor(color); + os << LogColor(color); return os; } diff --git a/server/snapServer.cpp b/server/snapServer.cpp index 0774731f..b23d9f79 100644 --- a/server/snapServer.cpp +++ b/server/snapServer.cpp @@ -145,8 +145,8 @@ int main(int argc, char* argv[]) Log::init( { - make_shared(debugSwitch.isSet()?(LogPriority::debug):(LogPriority::info), LogSink::Type::all, debugSwitch.isSet()?"%Y-%m-%d %H-%M-%S.#ms [#prio] (#tag)":"%Y-%m-%d %H-%M-%S [#prio]"), - make_shared("snapserver", LogPriority::debug, LogSink::Type::special) + make_shared(debugSwitch.isSet()?(LogSeverity::trace):(LogSeverity::info), LogSink::Type::all, debugSwitch.isSet()?"%Y-%m-%d %H-%M-%S.#ms [#prio] (#tag)":"%Y-%m-%d %H-%M-%S [#prio]"), + make_shared("snapserver", LogSeverity::trace, LogSink::Type::special) } );