Logger: Refactor time's format.

This commit is contained in:
Nodir Temirkhodjaev 2018-03-05 17:18:13 +05:00
parent 61c897a361
commit 806480f01a
2 changed files with 4 additions and 3 deletions

View File

@ -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()) {

View File

@ -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; }