| 77 | } |
| 78 | |
| 79 | static void rmExpiredLogs() |
| 80 | { |
| 81 | QtConcurrent::run([=](){ |
| 82 | QDirIterator itera(LogUtils::appCacheLogPath(),QDir::Files); |
| 83 | while(itera.hasNext()) { |
| 84 | itera.next(); |
| 85 | auto list = itera.fileName().split("_"); |
| 86 | if (itera.fileInfo().suffix() == "log" |
| 87 | && list.count() == 2 |
| 88 | && !LogUtils::containLastDay( |
| 89 | QDateTime(QDate::fromString(list[0],"yyyy-MM-dd"), |
| 90 | QTime(0,0,0,0)), |
| 91 | LogUtils::toDayZero(), |
| 92 | GlobalPrivate::dayCount)) |
| 93 | { |
| 94 | |
| 95 | auto outMsg = formatFrameworkLogOut(QtMsgType::QtInfoMsg, |
| 96 | QMessageLogContext{ |
| 97 | __FILE__, |
| 98 | __LINE__, |
| 99 | __FUNCTION__, |
| 100 | Framework().categoryName() |
| 101 | }, |
| 102 | QString("remove true(%0) not last week log: %1") |
| 103 | .arg(QDir().remove(itera.path() + QDir::separator() + itera.fileName())) |
| 104 | .arg(itera.fileName().toLocal8Bit().data()) |
| 105 | ); |
| 106 | |
| 107 | fprintf(stderr, "%s\n", outMsg.toUtf8().data()); |
| 108 | } |
| 109 | } |
| 110 | }); |
| 111 | } |
| 112 | |
| 113 | void redirectGlobalDebug(QtMsgType type, |
| 114 | const QMessageLogContext &context, |
no test coverage detected