Commit e8319587 authored by Halla Rempt's avatar Halla Rempt
Browse files

Truncate the log file if it's bigger than 100mb

Maybe we should make a back-up, though?

CCBUG:39537
parent af77a5f1
Pipeline #162606 passed with stage
in 47 minutes and 39 seconds
......@@ -51,7 +51,14 @@ KisUsageLogger::KisUsageLogger()
d->logFile.setFileName(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/krita.log");
d->sysInfoFile.setFileName(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/krita-sysinfo.log");
rotateLog();
QFileInfo fi(d->logFile.fileName());
if (fi.size() > 100 * 1000 * 1000) { // 100 mb seems a reasonable max
d->logFile.open(QIODevice::Truncate);
d->logFile.close();
}
else {
rotateLog();
}
d->logFile.open(QFile::Append | QFile::Text);
d->sysInfoFile.open(QFile::WriteOnly | QFile::Text);
......@@ -231,6 +238,7 @@ QString KisUsageLogger::screenInformation()
void KisUsageLogger::rotateLog()
{
if (d->logFile.exists()) {
{
// Check for CLOSING SESSION
d->logFile.open(QFile::ReadOnly);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment