mirror of
https://github.com/monero-project/monero-gui.git
synced 2026-04-08 12:57:25 -04:00
log qt/qml to easylogging, add --log-file cmdline option
This commit is contained in:
23
main.cpp
23
main.cpp
@@ -54,6 +54,7 @@
|
||||
#include "Subaddress.h"
|
||||
#include "model/SubaddressModel.h"
|
||||
#include "wallet/api/wallet2_api.h"
|
||||
#include "Logger.h"
|
||||
#include "MainApp.h"
|
||||
|
||||
// IOS exclusions
|
||||
@@ -70,12 +71,6 @@ bool isAndroid = false;
|
||||
bool isWindows = false;
|
||||
bool isDesktop = false;
|
||||
|
||||
void messageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
|
||||
{
|
||||
// Send all message types to logger
|
||||
Monero::Wallet::debug("qml", msg.toStdString());
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// platform dependant settings
|
||||
@@ -117,16 +112,24 @@ int main(int argc, char *argv[])
|
||||
app.installEventFilter(eventFilter);
|
||||
|
||||
QCommandLineParser parser;
|
||||
QCommandLineOption logPathOption(QStringList() << "l" << "log-file",
|
||||
QCoreApplication::translate("main", "Log to specified file"),
|
||||
QCoreApplication::translate("main", "file"));
|
||||
parser.addOption(logPathOption);
|
||||
parser.addHelpOption();
|
||||
parser.process(app);
|
||||
|
||||
Monero::Utils::onStartup();
|
||||
|
||||
// Log settings
|
||||
Monero::Wallet::init(argv[0], "monero-wallet-gui");
|
||||
// qInstallMessageHandler(messageHandler);
|
||||
const QString logPath = getLogPath(parser.value(logPathOption));
|
||||
Monero::Wallet::init(argv[0], "monero-wallet-gui", logPath.toStdString().c_str());
|
||||
qInstallMessageHandler(messageHandler);
|
||||
|
||||
qDebug() << "app startd";
|
||||
|
||||
// loglevel is configured in main.qml. Anything lower than
|
||||
// qWarning is not shown here.
|
||||
qWarning().noquote() << "app startd" << "(log: " + logPath + ")";
|
||||
|
||||
// screen settings
|
||||
// Mobile is designed on 128dpi
|
||||
@@ -217,6 +220,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
engine.rootContext()->setContextProperty("qtRuntimeVersion", qVersion());
|
||||
|
||||
engine.rootContext()->setContextProperty("walletLogPath", logPath);
|
||||
|
||||
// Exclude daemon manager from IOS
|
||||
#ifndef Q_OS_IOS
|
||||
const QStringList arguments = QCoreApplication::arguments();
|
||||
|
||||
Reference in New Issue
Block a user