mirror of
https://github.com/tnodir/fort
synced 2024-11-15 07:38:16 +00:00
UI: Fix old log files deleting.
This commit is contained in:
parent
02ea6870b5
commit
4f391599b3
@ -10,7 +10,7 @@
|
||||
#define LOGGER_FILE_PREFIX "log_fort_"
|
||||
#define LOGGER_FILE_SUFFIX ".txt"
|
||||
#define LOGGER_FILE_MAX_SIZE (1024 * 1024)
|
||||
#define LOGGER_KEEP_FILES 9
|
||||
#define LOGGER_KEEP_FILES 6
|
||||
|
||||
static QtMessageHandler g_oldMessageHandler = nullptr;
|
||||
|
||||
@ -115,6 +115,8 @@ void Logger::writeLog(const QString &message, LogLevel level)
|
||||
|
||||
// Create file when required to avoid empty files
|
||||
if (!m_file.isOpen()) {
|
||||
checkLogFiles();
|
||||
|
||||
if (!openLogFile()) {
|
||||
m_writing = false;
|
||||
return;
|
||||
@ -129,7 +131,6 @@ void Logger::writeLog(const QString &message, LogLevel level)
|
||||
|
||||
if (m_file.size() > LOGGER_FILE_MAX_SIZE) {
|
||||
closeLogFile(); // Too big file
|
||||
checkLogFiles();
|
||||
}
|
||||
|
||||
m_writing = false;
|
||||
|
Loading…
Reference in New Issue
Block a user