mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
Enter next log file if the current log file is larger than 512 KB when writing log line
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
e0a577172b
commit
eed5ca17bd
@ -35,6 +35,7 @@
|
||||
|
||||
namespace {
|
||||
constexpr int CrashLogSize = 20;
|
||||
constexpr int MaxLogSizeBytes = 1024 * 512;
|
||||
}
|
||||
namespace OCC {
|
||||
|
||||
@ -117,9 +118,14 @@ void Logger::doLog(QtMsgType type, const QMessageLogContext &ctx, const QString
|
||||
cout << msg << endl;
|
||||
#endif
|
||||
{
|
||||
if (_logFile.size() >= MaxLogSizeBytes) {
|
||||
enterNextLogFile();
|
||||
}
|
||||
|
||||
QMutexLocker lock(&_mutex);
|
||||
_crashLogIndex = (_crashLogIndex + 1) % CrashLogSize;
|
||||
_crashLog[_crashLogIndex] = msg;
|
||||
|
||||
if (_logstream) {
|
||||
(*_logstream) << msg << Qt::endl;
|
||||
if (_doFileFlush)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user