MODIFY:日志数据每次打开软件新增一个

This commit is contained in:
2024-01-01 20:12:51 +08:00
parent 789fc1a5d0
commit f700664636
+12 -1
View File
@@ -67,7 +67,18 @@ void LogHandler::installMessageHandler()
QDir _logDir(_logDirPath);
if(!_logDir.exists())
_logDir.mkpath(_logDirPath);
auto _logPath = _logDirPath + _currentDate + ".log";
QString _logPath;
for(int i = 1; i < 1000; ++i)
{
_logPath = _logDirPath + _currentDate + QString("_%1.log").arg(i);
QFileInfo _fileInfo(_logPath);
if(!_fileInfo.exists())
{
break;
}
}
g_file.setFileName(_logPath);
if(!g_file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append))
{