Commit 569eead1 authored by Pierre Kim's avatar Pierre Kim

bugfix: logging was not working with non-latin datadir

Added option to view logs from the main menu
parent a690717a
......@@ -20,7 +20,7 @@ void LoggerAdapter::init() {
Common::JsonValue& cfgLoggers = loggerConfiguration.insert("loggers", Common::JsonValue::ARRAY);
Common::JsonValue& fileLogger = cfgLoggers.pushBack(Common::JsonValue::OBJECT);
fileLogger.insert("type", "file");
fileLogger.insert("filename", Settings::instance().getDataDir().absoluteFilePath(QCoreApplication::applicationName() + ".log").toStdString());
fileLogger.insert("filename", std::string(Settings::instance().getDataDir().absoluteFilePath(QCoreApplication::applicationName() + ".log").toLocal8Bit().data()));
fileLogger.insert("level", static_cast<int64_t>(Logging::INFO));
m_logManager.configure(loggerConfiguration);
}
......
......@@ -7,6 +7,7 @@
#include <QInputDialog>
#include <QMessageBox>
#include <QSystemTrayIcon>
#include <QDesktopServices>
#include <QTimer>
#include <Common/Util.h>
......@@ -270,6 +271,13 @@ void MainWindow::resetWallet() {
}
}
void MainWindow::openLogFile() {
QString pathLog = Settings::instance().getDataDir().absoluteFilePath(QApplication::applicationName() + ".log");
if (!pathLog.isEmpty()) {
QDesktopServices::openUrl(QUrl::fromLocalFile(pathLog));
}
}
void MainWindow::encryptWallet() {
if (Settings::instance().isEncrypted()) {
bool error = false;
......
......@@ -64,6 +64,7 @@ private:
Q_SLOT void backupWallet();
Q_SLOT void resetWallet();
Q_SLOT void encryptWallet();
Q_SLOT void openLogFile();
Q_SLOT void aboutQt();
Q_SLOT void about();
Q_SLOT void setStartOnLogin(bool _on);
......
......@@ -122,6 +122,8 @@
<addaction name="m_backupWalletAction"/>
<addaction name="m_resetWalletAction"/>
<addaction name="separator"/>
<addaction name="m_openLogFileAction"/>
<addaction name="separator"/>
<addaction name="m_exitAction"/>
</widget>
<widget class="QMenu" name="menuSettings">
......@@ -323,6 +325,11 @@
<string>Backup wallet</string>
</property>
</action>
<action name="m_openLogFileAction">
<property name="text">
<string>Open log file</string>
</property>
</action>
<action name="m_resetWalletAction">
<property name="text">
<string>Reset wallet</string>
......@@ -584,6 +591,22 @@
</hint>
</hints>
</connection>
<connection>
<sender>m_openLogFileAction</sender>
<signal>triggered()</signal>
<receiver>MainWindow</receiver>
<slot>openLogFile()</slot>
<hints>
<hint type="sourcelabel">
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>449</x>
<y>299</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_resetWalletAction</sender>
<signal>triggered()</signal>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment