mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-19 06:57:24 -06:00
Implement file logger.
This commit is contained in:
@@ -58,6 +58,7 @@
|
||||
#endif
|
||||
|
||||
#include "application.h"
|
||||
#include "filelogger.h"
|
||||
#include "base/logger.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/utils/fs.h"
|
||||
@@ -103,10 +104,22 @@ Application::Application(const QString &id, int &argc, char **argv)
|
||||
|
||||
connect(this, SIGNAL(messageReceived(const QString &)), SLOT(processMessage(const QString &)));
|
||||
connect(this, SIGNAL(aboutToQuit()), SLOT(cleanup()));
|
||||
connect(Preferences::instance(), SIGNAL(changed()), SLOT(configure()));
|
||||
|
||||
configure();
|
||||
Logger::instance()->addMessage(tr("qBittorrent %1 started", "qBittorrent v3.2.0alpha started").arg(VERSION));
|
||||
}
|
||||
|
||||
void Application::configure()
|
||||
{
|
||||
bool fileLogEnabled = Preferences::instance()->fileLogEnabled();
|
||||
|
||||
if (fileLogEnabled && !m_fileLogger)
|
||||
m_fileLogger = new FileLogger;
|
||||
else if (!fileLogEnabled)
|
||||
delete m_fileLogger;
|
||||
}
|
||||
|
||||
void Application::processMessage(const QString &message)
|
||||
{
|
||||
QStringList params = message.split(QLatin1String(PARAMS_SEPARATOR), QString::SkipEmptyParts);
|
||||
@@ -466,6 +479,7 @@ void Application::cleanup()
|
||||
#endif
|
||||
Net::DownloadManager::freeInstance();
|
||||
Preferences::freeInstance();
|
||||
delete m_fileLogger;
|
||||
Logger::freeInstance();
|
||||
IconProvider::freeInstance();
|
||||
#ifndef DISABLE_GUI
|
||||
|
||||
Reference in New Issue
Block a user