mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-16 00:51:56 -05:00
Temporarily remove global Boost::log loggers
This commit is contained in:
parent
29b147eef0
commit
5a9b56bfc0
12
Logger.cpp
12
Logger.cpp
@ -34,12 +34,12 @@ namespace expr = logging::expressions;
|
|||||||
namespace attrs = logging::attributes;
|
namespace attrs = logging::attributes;
|
||||||
namespace ptime = boost::posix_time;
|
namespace ptime = boost::posix_time;
|
||||||
|
|
||||||
BOOST_LOG_GLOBAL_LOGGER_CTOR_ARGS (sys,
|
// BOOST_LOG_GLOBAL_LOGGER_CTOR_ARGS (sys,
|
||||||
srcs::severity_channel_logger_mt<logging::trivial::severity_level>,
|
// srcs::severity_channel_logger_mt<logging::trivial::severity_level>,
|
||||||
(keywords::channel = "SYSLOG"));
|
// (keywords::channel = "SYSLOG"));
|
||||||
BOOST_LOG_GLOBAL_LOGGER_CTOR_ARGS (data,
|
// BOOST_LOG_GLOBAL_LOGGER_CTOR_ARGS (data,
|
||||||
srcs::severity_channel_logger_mt<logging::trivial::severity_level>,
|
// srcs::severity_channel_logger_mt<logging::trivial::severity_level>,
|
||||||
(keywords::channel = "DATALOG"));
|
// (keywords::channel = "DATALOG"));
|
||||||
|
|
||||||
namespace Logger
|
namespace Logger
|
||||||
{
|
{
|
||||||
|
12
Logger.hpp
12
Logger.hpp
@ -10,10 +10,10 @@
|
|||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
BOOST_LOG_GLOBAL_LOGGER (sys,
|
// BOOST_LOG_GLOBAL_LOGGER (sys,
|
||||||
boost::log::sources::severity_channel_logger_mt<boost::log::trivial::severity_level>);
|
// boost::log::sources::severity_channel_logger_mt<boost::log::trivial::severity_level>);
|
||||||
BOOST_LOG_GLOBAL_LOGGER (data,
|
// BOOST_LOG_GLOBAL_LOGGER (data,
|
||||||
boost::log::sources::severity_channel_logger_mt<boost::log::trivial::severity_level>);
|
// boost::log::sources::severity_channel_logger_mt<boost::log::trivial::severity_level>);
|
||||||
|
|
||||||
namespace Logger
|
namespace Logger
|
||||||
{
|
{
|
||||||
@ -31,11 +31,15 @@ namespace Logger
|
|||||||
void add_data_file_log (std::string const& log_file_name);
|
void add_data_file_log (std::string const& log_file_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
#define LOG_LOG_LOCATION(LOGGER, LEVEL, ARG) \
|
#define LOG_LOG_LOCATION(LOGGER, LEVEL, ARG) \
|
||||||
BOOST_LOG_SEV (LOGGER, boost::log::trivial::LEVEL) \
|
BOOST_LOG_SEV (LOGGER, boost::log::trivial::LEVEL) \
|
||||||
<< boost::log::add_value ("Line", __LINE__) \
|
<< boost::log::add_value ("Line", __LINE__) \
|
||||||
<< boost::log::add_value ("File", __FILE__) \
|
<< boost::log::add_value ("File", __FILE__) \
|
||||||
<< boost::log::add_value ("Function", __FUNCTION__) << ARG;
|
<< boost::log::add_value ("Function", __FUNCTION__) << ARG;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define LOG_LOG_LOCATION(LOGGER, LEVEL, ARG)
|
||||||
|
|
||||||
/// System Log macros.
|
/// System Log macros.
|
||||||
/// TRACE < DEBUG < INFO < WARN < ERROR < FATAL
|
/// TRACE < DEBUG < INFO < WARN < ERROR < FATAL
|
||||||
|
@ -187,10 +187,10 @@ int HRDTransceiver::do_start ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
CAT_TRACE ("radios:-");
|
CAT_TRACE ("radios:-");
|
||||||
Q_FOREACH (auto const& radio, radios_)
|
// Q_FOREACH (auto const& radio, radios_)
|
||||||
{
|
// {
|
||||||
CAT_TRACE ("\t[" << std::get<0> (radio) << "] " << std::get<1> (radio));
|
// CAT_TRACE ("\t[" << std::get<0> (radio) << "] " << std::get<1> (radio));
|
||||||
}
|
// }
|
||||||
|
|
||||||
auto current_radio_name = send_command ("get radio", false, false);
|
auto current_radio_name = send_command ("get radio", false, false);
|
||||||
HRD_info << "Current radio: " << current_radio_name << "\n";
|
HRD_info << "Current radio: " << current_radio_name << "\n";
|
||||||
@ -407,11 +407,11 @@ void HRDTransceiver::map_modes (int dropdown, ModeMap *map)
|
|||||||
map->push_back (std::forward_as_tuple (DIG_FM, find_dropdown_selection (dropdown, QRegExp ("^(PKT-FM|PKT|DATA\\(FM\\)|FM)$"))));
|
map->push_back (std::forward_as_tuple (DIG_FM, find_dropdown_selection (dropdown, QRegExp ("^(PKT-FM|PKT|DATA\\(FM\\)|FM)$"))));
|
||||||
|
|
||||||
CAT_TRACE ("for dropdown" << dropdown_names_[dropdown]);
|
CAT_TRACE ("for dropdown" << dropdown_names_[dropdown]);
|
||||||
std::for_each (map->begin (), map->end (), [this, dropdown] (ModeMap::value_type const& item)
|
// std::for_each (map->begin (), map->end (), [this, dropdown] (ModeMap::value_type const& item)
|
||||||
{
|
// {
|
||||||
auto const& rhs = std::get<1> (item);
|
// auto const& rhs = std::get<1> (item);
|
||||||
CAT_TRACE ('\t' << std::get<0> (item) << "<->" << (rhs.size () ? dropdowns_[dropdown_names_[dropdown]][rhs.front ()] : "None"));
|
// CAT_TRACE ('\t' << std::get<0> (item) << "<->" << (rhs.size () ? dropdowns_[dropdown_names_[dropdown]][rhs.front ()] : "None"));
|
||||||
});
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
int HRDTransceiver::lookup_mode (MODE mode, ModeMap const& map) const
|
int HRDTransceiver::lookup_mode (MODE mode, ModeMap const& map) const
|
||||||
|
@ -193,21 +193,21 @@ WSJTXLogging::~WSJTXLogging ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reroute Qt messages to the system logger
|
// Reroute Qt messages to the system logger
|
||||||
void WSJTXLogging::qt_log_handler (QtMsgType type, QMessageLogContext const& context, QString const& msg)
|
void WSJTXLogging::qt_log_handler (QtMsgType type, QMessageLogContext const& context, QString const& /*msg*/)
|
||||||
{
|
{
|
||||||
// Convert Qt message types to logger severities
|
// Convert Qt message types to logger severities
|
||||||
auto severity = trivial::trace;
|
// auto severity = trivial::trace;
|
||||||
switch (type)
|
// switch (type)
|
||||||
{
|
// {
|
||||||
case QtDebugMsg: severity = trivial::debug; break;
|
// case QtDebugMsg: severity = trivial::debug; break;
|
||||||
case QtInfoMsg: severity = trivial::info; break;
|
// case QtInfoMsg: severity = trivial::info; break;
|
||||||
case QtWarningMsg: severity = trivial::warning; break;
|
// case QtWarningMsg: severity = trivial::warning; break;
|
||||||
case QtCriticalMsg: severity = trivial::error; break;
|
// case QtCriticalMsg: severity = trivial::error; break;
|
||||||
case QtFatalMsg: severity = trivial::fatal; break;
|
// case QtFatalMsg: severity = trivial::fatal; break;
|
||||||
}
|
// }
|
||||||
// Map non-default Qt categories to logger channels, Qt logger
|
// Map non-default Qt categories to logger channels, Qt logger
|
||||||
// context is mapped to the appropriate logger attributes.
|
// context is mapped to the appropriate logger attributes.
|
||||||
auto log = sys::get ();
|
// auto log = sys::get ();
|
||||||
std::string file;
|
std::string file;
|
||||||
std::string function;
|
std::string function;
|
||||||
if (context.file)
|
if (context.file)
|
||||||
@ -220,19 +220,19 @@ void WSJTXLogging::qt_log_handler (QtMsgType type, QMessageLogContext const& con
|
|||||||
}
|
}
|
||||||
if (!context.category || !qstrcmp (context.category, "default"))
|
if (!context.category || !qstrcmp (context.category, "default"))
|
||||||
{
|
{
|
||||||
BOOST_LOG_SEV (log, severity)
|
// BOOST_LOG_SEV (log, severity)
|
||||||
<< boost::log::add_value ("Line", context.line)
|
// << boost::log::add_value ("Line", context.line)
|
||||||
<< boost::log::add_value ("File", file)
|
// << boost::log::add_value ("File", file)
|
||||||
<< boost::log::add_value ("Function", function)
|
// << boost::log::add_value ("Function", function)
|
||||||
<< msg.toStdString ();
|
// << msg.toStdString ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BOOST_LOG_CHANNEL_SEV (log, std::string {context.category}, severity)
|
// BOOST_LOG_CHANNEL_SEV (log, std::string {context.category}, severity)
|
||||||
<< boost::log::add_value ("Line", context.line)
|
// << boost::log::add_value ("Line", context.line)
|
||||||
<< boost::log::add_value ("File", file)
|
// << boost::log::add_value ("File", file)
|
||||||
<< boost::log::add_value ("Function", function)
|
// << boost::log::add_value ("Function", function)
|
||||||
<< msg.toStdString ();
|
// << msg.toStdString ();
|
||||||
}
|
}
|
||||||
if (QtFatalMsg == type)
|
if (QtFatalMsg == type)
|
||||||
{
|
{
|
||||||
|
114
main.cpp
114
main.cpp
@ -71,29 +71,29 @@ namespace
|
|||||||
} seeding;
|
} seeding;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void safe_stream_QVariant (boost::log::record_ostream& os, QVariant const& v)
|
// void safe_stream_QVariant (boost::log::record_ostream& os, QVariant const& v)
|
||||||
{
|
// {
|
||||||
switch (static_cast<QMetaType::Type> (v.type ()))
|
// switch (static_cast<QMetaType::Type> (v.type ()))
|
||||||
{
|
// {
|
||||||
case QMetaType::QByteArray:
|
// case QMetaType::QByteArray:
|
||||||
os << "0x" << v.toByteArray ().toHex (':').toStdString ();
|
// os << "0x" << v.toByteArray ().toHex (':').toStdString ();
|
||||||
break;
|
// break;
|
||||||
|
|
||||||
case QMetaType::QBitArray:
|
// case QMetaType::QBitArray:
|
||||||
{
|
// {
|
||||||
auto const& bits = v.toBitArray ();
|
// auto const& bits = v.toBitArray ();
|
||||||
os << "0b";
|
// os << "0b";
|
||||||
for (int i = 0; i < bits.size (); ++ i)
|
// for (int i = 0; i < bits.size (); ++ i)
|
||||||
{
|
// {
|
||||||
os << (bits[i] ? '1' : '0');
|
// os << (bits[i] ? '1' : '0');
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
break;
|
// break;
|
||||||
|
|
||||||
default:
|
// default:
|
||||||
os << v.toString ();
|
// os << v.toString ();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
@ -325,42 +325,42 @@ int main(int argc, char *argv[])
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
// dump settings
|
// dump settings
|
||||||
auto sys_lg = sys::get ();
|
// auto sys_lg = sys::get ();
|
||||||
if (auto rec = sys_lg.open_record
|
// if (auto rec = sys_lg.open_record
|
||||||
(
|
// (
|
||||||
boost::log::keywords::severity = boost::log::trivial::trace)
|
// boost::log::keywords::severity = boost::log::trivial::trace)
|
||||||
)
|
// )
|
||||||
{
|
// {
|
||||||
boost::log::record_ostream strm (rec);
|
// boost::log::record_ostream strm (rec);
|
||||||
strm << "++++++++++++++++++++++++++++ Settings ++++++++++++++++++++++++++++\n";
|
// strm << "++++++++++++++++++++++++++++ Settings ++++++++++++++++++++++++++++\n";
|
||||||
for (auto const& key: multi_settings.settings ()->allKeys ())
|
// for (auto const& key: multi_settings.settings ()->allKeys ())
|
||||||
{
|
// {
|
||||||
if (!key.contains (QRegularExpression {"^MultiSettings/[^/]*/"}))
|
// if (!key.contains (QRegularExpression {"^MultiSettings/[^/]*/"}))
|
||||||
{
|
// {
|
||||||
auto const& value = multi_settings.settings ()->value (key);
|
// auto const& value = multi_settings.settings ()->value (key);
|
||||||
if (value.canConvert<QVariantList> ())
|
// if (value.canConvert<QVariantList> ())
|
||||||
{
|
// {
|
||||||
auto const sequence = value.value<QSequentialIterable> ();
|
// auto const sequence = value.value<QSequentialIterable> ();
|
||||||
strm << key << ":\n";
|
// strm << key << ":\n";
|
||||||
for (auto const& item: sequence)
|
// for (auto const& item: sequence)
|
||||||
{
|
// {
|
||||||
strm << "\t";
|
// strm << "\t";
|
||||||
safe_stream_QVariant (strm, item);
|
// safe_stream_QVariant (strm, item);
|
||||||
strm << '\n';
|
// strm << '\n';
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
strm << key << ": ";
|
// strm << key << ": ";
|
||||||
safe_stream_QVariant (strm, value);
|
// safe_stream_QVariant (strm, value);
|
||||||
strm << '\n';
|
// strm << '\n';
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
strm << "---------------------------- Settings ----------------------------\n";
|
// strm << "---------------------------- Settings ----------------------------\n";
|
||||||
strm.flush ();
|
// strm.flush ();
|
||||||
sys_lg.push_record (boost::move (rec));
|
// sys_lg.push_record (boost::move (rec));
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Create and initialize shared memory segment
|
// Create and initialize shared memory segment
|
||||||
// Multiple instances: use rig_name as shared memory key
|
// Multiple instances: use rig_name as shared memory key
|
||||||
|
Loading…
Reference in New Issue
Block a user