MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / rmExpiredLogs

Function rmExpiredLogs

src/framework/log/frameworklog.cpp:79–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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,

Callers 1

redirectGlobalDebugFunction · 0.70

Calls 8

formatFrameworkLogOutFunction · 0.85
fileNameMethod · 0.80
QStringClass · 0.50
nextMethod · 0.45
countMethod · 0.45
removeMethod · 0.45
pathMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected