diff --git a/WSJTXLogging.cpp b/WSJTXLogging.cpp index aa6e39d3a..6d81936d7 100644 --- a/WSJTXLogging.cpp +++ b/WSJTXLogging.cpp @@ -1,5 +1,6 @@ #include "WSJTXLogging.hpp" +#include #include #include @@ -11,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -34,6 +36,9 @@ namespace sinks = logging::sinks; namespace ptime = boost::posix_time; namespace container = boost::container; +BOOST_LOG_ATTRIBUTE_KEYWORD(severity, "Severity", trivial::severity_level) +BOOST_LOG_ATTRIBUTE_KEYWORD(channel, "Channel", std::wstring) + namespace { // Top level exception handler that gets exceptions from filters and @@ -141,10 +146,20 @@ WSJTXLogging::WSJTXLogging () ) ); sys_sink->locked_backend ()->scan_for_files (); + + // Per channel severity level filter + using min_severity_filter = expr::channel_severity_filter_actor; + min_severity_filter min_severity = expr::channel_severity_filter (channel, severity); + min_severity[L"SYSLOG"] = trivial::trace; + min_severity[L"RIGCTRL"] = trivial::info; + min_severity[L"DATALOG"] = trivial::info; + sys_sink->set_filter (min_severity || severity >= trivial::fatal); + sys_sink->set_formatter ( expr::stream - << "[" << expr::format_date_time ("TimeStamp", "%Y-%m-%d %H:%M:%S.%f") + << "[" << channel + << "][" << expr::format_date_time ("TimeStamp", "%Y-%m-%d %H:%M:%S.%f") << "][" << expr::format_date_time ("Uptime", "%O:%M:%S.%f") << "][" << trivial::severity << "] " << expr::message