From: Matthieu Gallien Date: Mon, 12 Jun 2023 15:02:51 +0000 (+0200) Subject: only flush debug log files when closing them X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~92^2^2~31^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=c015fa00fd2ab912426535286201f03594799e68;p=nextcloud-desktop.git only flush debug log files when closing them do not force a flush every time a log line is added to a file to speed up the logging process Signed-off-by: Matthieu Gallien --- diff --git a/src/libsync/logger.cpp b/src/libsync/logger.cpp index 8cd029cf9..7a050a103 100644 --- a/src/libsync/logger.cpp +++ b/src/libsync/logger.cpp @@ -89,6 +89,9 @@ Logger::Logger(QObject *parent) Logger::~Logger() { + if (_logstream) { + _logstream->flush(); + } #ifndef NO_MSG_HANDLER qInstallMessageHandler(nullptr); #endif @@ -144,6 +147,9 @@ void Logger::doLog(QtMsgType type, const QMessageLogContext &ctx, const QString if (linesCounter >= MaxLogLinesCount) { linesCounter = 0; + if (_logstream) { + _logstream->flush(); + } closeNoLock(); enterNextLogFileNoLock(); } @@ -153,7 +159,7 @@ void Logger::doLog(QtMsgType type, const QMessageLogContext &ctx, const QString _crashLog[_crashLogIndex] = msg; if (_logstream) { - (*_logstream) << msg << Qt::endl; + (*_logstream) << msg << "\n"; if (_doFileFlush) _logstream->flush(); }