mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
Add --debug switch
This commit is contained in:
parent
a70044e67b
commit
dd1dca3751
2 changed files with 8 additions and 1 deletions
|
@ -81,10 +81,12 @@ init(const std::string &file_path)
|
|||
std::make_shared<spdlog::logger>("crypto", std::begin(sinks), std::end(sinks));
|
||||
qml_logger = std::make_shared<spdlog::logger>("qml", std::begin(sinks), std::end(sinks));
|
||||
|
||||
if (nheko::enable_debug_log) {
|
||||
if (nheko::enable_debug_log || enable_debug_log_from_commandline) {
|
||||
db_logger->set_level(spdlog::level::trace);
|
||||
ui_logger->set_level(spdlog::level::trace);
|
||||
crypto_logger->set_level(spdlog::level::trace);
|
||||
net_logger->set_level(spdlog::level::trace);
|
||||
qml_logger->set_level(spdlog::level::trace);
|
||||
}
|
||||
|
||||
qInstallMessageHandler(qmlMessageHandler);
|
||||
|
|
|
@ -128,6 +128,8 @@ main(int argc, char *argv[])
|
|||
QCommandLineParser parser;
|
||||
parser.addHelpOption();
|
||||
parser.addVersionOption();
|
||||
QCommandLineOption debugOption("debug", "Enable debug output");
|
||||
parser.addOption(debugOption);
|
||||
parser.process(app);
|
||||
|
||||
app.setWindowIcon(QIcon(":/logos/nheko.png"));
|
||||
|
@ -138,6 +140,9 @@ main(int argc, char *argv[])
|
|||
|
||||
registerSignalHandlers();
|
||||
|
||||
if (parser.isSet(debugOption))
|
||||
nhlog::enable_debug_log_from_commandline = true;
|
||||
|
||||
try {
|
||||
nhlog::init(QString("%1/nheko.log")
|
||||
.arg(QStandardPaths::writableLocation(QStandardPaths::CacheLocation))
|
||||
|
|
Loading…
Reference in a new issue