Added activation and deactivation of logging without restarting the application
This commit is contained in:
parent
ce4ca5c4d5
commit
195663c6e3
3 changed files with 23 additions and 0 deletions
|
|
@ -80,6 +80,14 @@ bool Debug::init()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Debug::deInit()
|
||||||
|
{
|
||||||
|
qInstallMessageHandler(0);
|
||||||
|
qSetMessagePattern("%{message}");
|
||||||
|
m_textStream.setDevice(nullptr);
|
||||||
|
m_file.close();
|
||||||
|
}
|
||||||
|
|
||||||
QString Debug::userLogsDir()
|
QString Debug::userLogsDir()
|
||||||
{
|
{
|
||||||
return QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/log";
|
return QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/log";
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ public:
|
||||||
|
|
||||||
|
|
||||||
static bool init();
|
static bool init();
|
||||||
|
static void deInit();
|
||||||
static bool openLogsFolder();
|
static bool openLogsFolder();
|
||||||
static bool openServiceLogsFolder();
|
static bool openServiceLogsFolder();
|
||||||
static QString appLogFileNamePath();
|
static QString appLogFileNamePath();
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
|
|
||||||
#include "containers/containers_defs.h"
|
#include "containers/containers_defs.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
const char Settings::cloudFlareNs1[] = "1.1.1.1";
|
const char Settings::cloudFlareNs1[] = "1.1.1.1";
|
||||||
const char Settings::cloudFlareNs2[] = "1.0.0.1";
|
const char Settings::cloudFlareNs2[] = "1.0.0.1";
|
||||||
|
|
@ -206,6 +207,19 @@ QString Settings::nextAvailableServerName() const
|
||||||
return tr("Server") + " " + QString::number(i);
|
return tr("Server") + " " + QString::number(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Settings::setSaveLogs(bool enabled)
|
||||||
|
{
|
||||||
|
m_settings.setValue("Conf/saveLogs", enabled);
|
||||||
|
if (!isSaveLogs()) {
|
||||||
|
Debug::deInit();
|
||||||
|
} else {
|
||||||
|
if (!Debug::init()) {
|
||||||
|
qWarning() << "Initialization of debug subsystem failed";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
emit updateVpnPage();
|
||||||
|
}
|
||||||
|
|
||||||
QString Settings::routeModeString(RouteMode mode) const
|
QString Settings::routeModeString(RouteMode mode) const
|
||||||
{
|
{
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue