mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-22 04:11:16 -05:00
Move global loggers to the global namespace
Avoiding namespace scope globals as initialization order is less well defined.
This commit is contained in:
parent
573b7ea1c8
commit
d7eac1803d
14
Logger.cpp
14
Logger.cpp
@ -31,15 +31,15 @@ namespace expr = logging::expressions;
|
||||
namespace attrs = logging::attributes;
|
||||
namespace ptime = boost::posix_time;
|
||||
|
||||
BOOST_LOG_GLOBAL_LOGGER_CTOR_ARGS (sys,
|
||||
srcs::severity_channel_logger_mt<logging::trivial::severity_level>,
|
||||
(keywords::channel = "SYSLOG"));
|
||||
BOOST_LOG_GLOBAL_LOGGER_CTOR_ARGS (data,
|
||||
srcs::severity_channel_logger_mt<logging::trivial::severity_level>,
|
||||
(keywords::channel = "DATALOG"));
|
||||
|
||||
namespace Logger
|
||||
{
|
||||
BOOST_LOG_GLOBAL_LOGGER_CTOR_ARGS (sys,
|
||||
srcs::severity_channel_logger_mt<logging::trivial::severity_level>,
|
||||
(keywords::channel = "SYSLOG"));
|
||||
BOOST_LOG_GLOBAL_LOGGER_CTOR_ARGS (data,
|
||||
srcs::severity_channel_logger_mt<logging::trivial::severity_level>,
|
||||
(keywords::channel = "DATALOG"));
|
||||
|
||||
namespace
|
||||
{
|
||||
// Custom formatter factory to add TimeStamp format support in config ini file.
|
||||
|
34
Logger.hpp
34
Logger.hpp
@ -10,13 +10,13 @@
|
||||
#include <iosfwd>
|
||||
#include <string>
|
||||
|
||||
BOOST_LOG_GLOBAL_LOGGER (sys,
|
||||
boost::log::sources::severity_channel_logger_mt<boost::log::trivial::severity_level>);
|
||||
BOOST_LOG_GLOBAL_LOGGER (data,
|
||||
boost::log::sources::severity_channel_logger_mt<boost::log::trivial::severity_level>);
|
||||
|
||||
namespace Logger
|
||||
{
|
||||
BOOST_LOG_GLOBAL_LOGGER (sys,
|
||||
boost::log::sources::severity_channel_logger_mt<boost::log::trivial::severity_level>);
|
||||
BOOST_LOG_GLOBAL_LOGGER (data,
|
||||
boost::log::sources::severity_channel_logger_mt<boost::log::trivial::severity_level>);
|
||||
|
||||
// trivial logging to console
|
||||
void init ();
|
||||
|
||||
@ -39,20 +39,20 @@ namespace Logger
|
||||
|
||||
/// System Log macros.
|
||||
/// TRACE < DEBUG < INFO < WARN < ERROR < FATAL
|
||||
#define LOG_TRACE(ARG) LOG_LOG_LOCATION (Logger::sys::get(), trace, ARG);
|
||||
#define LOG_DEBUG(ARG) LOG_LOG_LOCATION (Logger::sys::get(), debug, ARG);
|
||||
#define LOG_INFO(ARG) LOG_LOG_LOCATION (Logger::sys::get(), info, ARG);
|
||||
#define LOG_WARN(ARG) LOG_LOG_LOCATION (Logger::sys::get(), warning, ARG);
|
||||
#define LOG_ERROR(ARG) LOG_LOG_LOCATION (Logger::sys::get(), error, ARG);
|
||||
#define LOG_FATAL(ARG) LOG_LOG_LOCATION (Logger::sys::get(), fatal, ARG);
|
||||
#define LOG_TRACE(ARG) LOG_LOG_LOCATION (sys::get(), trace, ARG);
|
||||
#define LOG_DEBUG(ARG) LOG_LOG_LOCATION (sys::get(), debug, ARG);
|
||||
#define LOG_INFO(ARG) LOG_LOG_LOCATION (sys::get(), info, ARG);
|
||||
#define LOG_WARN(ARG) LOG_LOG_LOCATION (sys::get(), warning, ARG);
|
||||
#define LOG_ERROR(ARG) LOG_LOG_LOCATION (sys::get(), error, ARG);
|
||||
#define LOG_FATAL(ARG) LOG_LOG_LOCATION (sys::get(), fatal, ARG);
|
||||
|
||||
/// Data Log macros. Does not include LINE, FILE, FUNCTION.
|
||||
/// TRACE < DEBUG < INFO < WARN < ERROR < FATAL
|
||||
#define LOG_DATA_TRACE(ARG) BOOST_LOG_SEV (Logger::data::get(), boost::log::trivial::trace) << ARG
|
||||
#define LOG_DATA_DEBUG(ARG) BOOST_LOG_SEV (Logger::data::get(), boost::log::trivial::debug) << ARG
|
||||
#define LOG_DATA_INFO(ARG) BOOST_LOG_SEV (Logger::data::get(), boost::log::trivial::info) << ARG
|
||||
#define LOG_DATA_WARN(ARG) BOOST_LOG_SEV (Logger::data::get(), boost::log::trivial::warning) << ARG
|
||||
#define LOG_DATA_ERROR(ARG) BOOST_LOG_SEV (Logger::data::get(), boost::log::trivial::error) << ARG
|
||||
#define LOG_DATA_FATAL(ARG) BOOST_LOG_SEV (Logger::data::get(), boost::log::trivial::fatal) << ARG
|
||||
#define LOG_DATA_TRACE(ARG) BOOST_LOG_SEV (data::get(), boost::log::trivial::trace) << ARG
|
||||
#define LOG_DATA_DEBUG(ARG) BOOST_LOG_SEV (data::get(), boost::log::trivial::debug) << ARG
|
||||
#define LOG_DATA_INFO(ARG) BOOST_LOG_SEV (data::get(), boost::log::trivial::info) << ARG
|
||||
#define LOG_DATA_WARN(ARG) BOOST_LOG_SEV (data::get(), boost::log::trivial::warning) << ARG
|
||||
#define LOG_DATA_ERROR(ARG) BOOST_LOG_SEV (data::get(), boost::log::trivial::error) << ARG
|
||||
#define LOG_DATA_FATAL(ARG) BOOST_LOG_SEV (data::get(), boost::log::trivial::fatal) << ARG
|
||||
|
||||
#endif
|
||||
|
@ -200,7 +200,7 @@ void WSJTXLogging::qt_log_handler (QtMsgType type, QMessageLogContext const& con
|
||||
}
|
||||
// Map non-default Qt categories to logger channels, Qt logger
|
||||
// context is mapped to the appropriate logger attributes.
|
||||
auto log = Logger::sys::get ();
|
||||
auto log = sys::get ();
|
||||
std::string file;
|
||||
std::string function;
|
||||
if (context.file)
|
||||
|
Loading…
Reference in New Issue
Block a user