Browse Source

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

master
tianzhendong 11 months ago
parent
commit
f700664636
  1. 13
      loghandler.cpp

13
loghandler.cpp

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

Loading…
Cancel
Save