use nextcloud.log suffix for log files of desktop client
authorMatthieu Gallien <matthieu.gallien@nextcloud.com>
Tue, 13 Dec 2022 10:13:55 +0000 (11:13 +0100)
committerMatthieu Gallien <matthieu_gallien@yahoo.fr>
Thu, 15 Dec 2022 10:11:20 +0000 (11:11 +0100)
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
src/libsync/logger.cpp

index 294ad2bb6b704da39f60d3e8b195a3869bf4e639..6087717486ca5317d30f776bd156f78d7448f82d 100644 (file)
@@ -301,12 +301,12 @@ void Logger::enterNextLogFile()
 
         // Tentative new log name, will be adjusted if one like this already exists
         QDateTime now = QDateTime::currentDateTime();
-        QString newLogName = now.toString("yyyyMMdd_HHmm") + "_owncloud.log";
+        QString newLogName = now.toString("yyyyMMdd_HHmm") + "_nextcloud.log";
 
         // Expire old log files and deal with conflicts
-        QStringList files = dir.entryList(QStringList("*owncloud.log.*"),
-            QDir::Files, QDir::Name);
-        const QRegularExpression rx(QRegularExpression::anchoredPattern(R"(.*owncloud\.log\.(\d+).*)"));
+        QStringList files = dir.entryList(QStringList("*owncloud.log.*"), QDir::Files, QDir::Name) +
+            dir.entryList(QStringList("*nextcloud.log.*"), QDir::Files, QDir::Name);
+        const QRegularExpression rx(QRegularExpression::anchoredPattern(R"(.*(next|own)cloud\.log\.(\d+).*)"));
         int maxNumber = -1;
         foreach (const QString &s, files) {
             if (_logExpire > 0) {
@@ -317,7 +317,7 @@ void Logger::enterNextLogFile()
             }
             const auto rxMatch = rx.match(s);
             if (s.startsWith(newLogName) && rxMatch.hasMatch()) {
-                maxNumber = qMax(maxNumber, rxMatch.captured(1).toInt());
+                maxNumber = qMax(maxNumber, rxMatch.captured(2).toInt());
             }
         }
         newLogName.append("." + QString::number(maxNumber + 1));