mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-06-18 14:22:26 -04:00
Dump current settings to trace log at startup
This commit is contained in:
parent
d587325f65
commit
030c8868ab
58
main.cpp
58
main.cpp
@ -2,7 +2,9 @@
|
|||||||
#include <exception>
|
#include <exception>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <iterator>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <ios>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <fftw3.h>
|
#include <fftw3.h>
|
||||||
|
|
||||||
@ -63,6 +65,29 @@ namespace
|
|||||||
}
|
}
|
||||||
} seeding;
|
} seeding;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void safe_stream_QVariant (boost::log::wrecord_ostream& os, QVariant const& v)
|
||||||
|
{
|
||||||
|
if (QMetaType::QByteArray == static_cast<QMetaType::Type> (v.type ()))
|
||||||
|
{
|
||||||
|
auto const& a =v.toByteArray ();
|
||||||
|
std::ios::fmtflags f (os.flags ());
|
||||||
|
os << std::hex << std::showbase;
|
||||||
|
for (auto p = a.begin (); p != a.end (); )
|
||||||
|
{
|
||||||
|
os << static_cast<int8_t> (*p++);
|
||||||
|
if (p != a.end ())
|
||||||
|
{
|
||||||
|
os << ' ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
os.flags (f);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
os << v.toString ().toStdWString ();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
@ -291,28 +316,43 @@ int main(int argc, char *argv[])
|
|||||||
auto const& original_style_sheet = a.styleSheet ();
|
auto const& original_style_sheet = a.styleSheet ();
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
#if WSJT_QDEBUG_TO_FILE
|
// dump settings
|
||||||
// announce to trace file and dump settings
|
auto sys_lg = Logger::sys::get ();
|
||||||
qDebug () << "++++++++++++++++++++++++++++ Settings ++++++++++++++++++++++++++++";
|
if (auto rec = sys_lg.open_record
|
||||||
|
(
|
||||||
|
boost::log::keywords::severity = boost::log::trivial::trace)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
boost::log::wrecord_ostream strm (rec);
|
||||||
|
strm << "++++++++++++++++++++++++++++ Settings ++++++++++++++++++++++++++++\n";
|
||||||
for (auto const& key: multi_settings.settings ()->allKeys ())
|
for (auto const& key: multi_settings.settings ()->allKeys ())
|
||||||
|
{
|
||||||
|
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> ();
|
||||||
qDebug ().nospace () << key << ": ";
|
strm << key.toStdWString () << ":\n";
|
||||||
for (auto const& item: sequence)
|
for (auto const& item: sequence)
|
||||||
{
|
{
|
||||||
qDebug ().nospace () << '\t' << item;
|
strm << "\t";
|
||||||
|
safe_stream_QVariant (strm, item);
|
||||||
|
strm << '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug ().nospace () << key << ": " << value;
|
strm << key.toStdWString () << ": ";
|
||||||
|
safe_stream_QVariant (strm, value);
|
||||||
|
strm << '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qDebug () << "---------------------------- Settings ----------------------------";
|
}
|
||||||
#endif
|
strm << "---------------------------- Settings ----------------------------\n";
|
||||||
|
strm.flush ();
|
||||||
|
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…
x
Reference in New Issue
Block a user