MODIFY:日志数据每次打开软件新增一个
This commit is contained in:
+12
-1
@@ -67,7 +67,18 @@ void LogHandler::installMessageHandler()
|
|||||||
QDir _logDir(_logDirPath);
|
QDir _logDir(_logDirPath);
|
||||||
if(!_logDir.exists())
|
if(!_logDir.exists())
|
||||||
_logDir.mkpath(_logDirPath);
|
_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);
|
g_file.setFileName(_logPath);
|
||||||
if(!g_file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append))
|
if(!g_file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user