| 37 | #endif |
| 38 | |
| 39 | static void rmExpiredLogs() |
| 40 | { |
| 41 | QtConcurrent::run([=](){ |
| 42 | QDirIterator itera(LogUtils::appCacheLogPath() |
| 43 | + QDir::separator() + tcDirName); |
| 44 | while(itera.hasNext()) { |
| 45 | itera.next(); |
| 46 | auto list = itera.fileName().split("_"); |
| 47 | if (itera.fileInfo().suffix() == "csv" |
| 48 | && list.count() == 3 |
| 49 | && !LogUtils::containLastDay( |
| 50 | QDateTime(QDate::fromString(list[0],"yyyy-MM-dd"), |
| 51 | QTime(0,0,0,0)), |
| 52 | LogUtils::toDayZero(), |
| 53 | GlobalPrivate::dayCount)) |
| 54 | { |
| 55 | qInfo("remove true(%d) not last week log: %s", |
| 56 | QDir().remove(itera.path() + QDir::separator() + itera.fileName()), |
| 57 | itera.fileName().toLocal8Bit().data()); |
| 58 | } |
| 59 | } |
| 60 | }); |
| 61 | } |
| 62 | |
| 63 | static void outCheck(const QMessageLogContext &context, const QString &msg) |
| 64 | { |