mirror of
https://github.com/tnodir/fort
synced 2024-11-15 08:56:22 +00:00
Logger: Refactor time's format.
This commit is contained in:
parent
61c897a361
commit
806480f01a
@ -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()) {
|
||||
|
@ -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; }
|
||||
|
Loading…
Reference in New Issue
Block a user