From 806480f01a3cdb0e0ebbb89b2cd6d21e21455f0c Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Mon, 5 Mar 2018 17:18:13 +0500 Subject: [PATCH] Logger: Refactor time's format. --- src/ui/util/logger.cpp | 5 +++-- src/ui/util/logger.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ui/util/logger.cpp b/src/ui/util/logger.cpp index 439fb66d..c598a095 100644 --- a/src/ui/util/logger.cpp +++ b/src/ui/util/logger.cpp @@ -97,7 +97,8 @@ void Logger::writeLogLine(Logger::LogLevel level, const QString &dateString, static const char * const g_levelTexts[] = { "[Info]", "[Warn]", "[Fail]"}; - const QString line = dateString + g_levelTexts[int(level)] + const QString line = dateString + + ' ' + g_levelTexts[int(level)] + ' ' + message + '\n'; m_file.write(line.toLatin1()); @@ -112,7 +113,7 @@ void Logger::writeLog(const QString &message, LogLevel level) m_writing = true; const QString dateString = QDateTime::currentDateTime() - .toString("'['yyyy-MM-dd HH:mm:ss']'"); + .toString("yyyy-MM-dd HH:mm:ss"); // Create file when required to avoid empty files if (!m_file.isOpen()) { diff --git a/src/ui/util/logger.h b/src/ui/util/logger.h index 8a7d7862..3986dacd 100644 --- a/src/ui/util/logger.h +++ b/src/ui/util/logger.h @@ -13,7 +13,7 @@ protected: explicit Logger(QObject *parent = nullptr); public: - enum LogLevel { Info = 0, Warning, Error, LevelCount }; + enum LogLevel { Info = 0, Warning, Error }; Q_ENUM(LogLevel) bool active() const { return m_active; }