From ca4aab57338d25ca9191f0393a161584b4ff605a Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Wed, 20 Dec 2023 14:44:33 +0300 Subject: [PATCH] UI: Logger: Improve log file title --- src/ui/manager/logger.cpp | 8 +++++++- src/ui/manager/logger.h | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ui/manager/logger.cpp b/src/ui/manager/logger.cpp index 99070d10..4f19ab3e 100644 --- a/src/ui/manager/logger.cpp +++ b/src/ui/manager/logger.cpp @@ -106,6 +106,12 @@ void Logger::setPath(const QString &path) m_dir.setPath(path); } +QString Logger::getFileTitle() const +{ + return QLatin1String(APP_NAME) + " v" + APP_VERSION_STR + + (isService() ? " Service" : QString()); +} + Logger *Logger::instance() { static Logger *g_instanceLogger = nullptr; @@ -196,7 +202,7 @@ void Logger::writeLog(const QString &dateString, const QString &logLine) } // Write file header - writeLogLine(makeLogLine(Info, dateString, APP_NAME " v" APP_VERSION_STR)); + writeLogLine(makeLogLine(Info, dateString, getFileTitle())); } writeLogLine(logLine); diff --git a/src/ui/manager/logger.h b/src/ui/manager/logger.h index bd1d1f00..72d7231d 100644 --- a/src/ui/manager/logger.h +++ b/src/ui/manager/logger.h @@ -26,6 +26,8 @@ public: void setPath(const QString &path); + QString getFileTitle() const; + static Logger *instance(); static QString getDateString();