Add desktop log rotation on startup and size limit
This commit is contained in:
1 parent
f5bac950d1
commit
9a69238a77
9 files changed
+440
-26
No files matched your search
@@ -170,8 +170,11 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
/* Ошибка подготовки INI возможна ещё до чтения debug_file из профиля. */
|
||||
const QByteArray startupLogPath = (cfgDir + "/chatgui.log").toUtf8();
|
||||
const QString startupLogFile = cfgDir + "/chatgui.log";
|
||||
const QByteArray startupLogPath = startupLogFile.toUtf8();
|
||||
debug_set_file_rotation(10 * 1024 * 1024, 5);
|
||||
debug_enable_file_output(startupLogPath.constData(), 0);
|
||||
if (g_debug_config.file_output) debug_rotate_log();
|
||||
DEBUG_INFO(DEBUG_CATEGORY_CONFIG, "GUI startup: version=%s config_directory=%s", qPrintable(app.applicationVersion()), qPrintable(cfgDir));
|
||||
#ifdef _WIN32
|
||||
DEBUG_INFO(DEBUG_CATEGORY_CONFIG, "Windows storage selection: %s", qPrintable(storageReason));
|
||||
@@ -344,6 +347,8 @@ int main(int argc, char *argv[]) {
|
||||
debug_enable_function_name(0);
|
||||
const QByteArray debugFilePath = debugFile.toUtf8(); // Logger заимствует путь до закрытия/замены файла.
|
||||
debug_enable_file_output(debugFilePath.constData(), 0);
|
||||
if (g_debug_config.output_file == debugFilePath.constData() &&
|
||||
QFileInfo(debugFile).canonicalFilePath() != QFileInfo(startupLogFile).canonicalFilePath()) debug_rotate_log();
|
||||
QString lvl = cfg.debugLevel().trimmed();
|
||||
if (lvl.isEmpty()) lvl = QStringLiteral("info");
|
||||
debug_apply_global_level(lvl.toUtf8().constData());
|
||||
|
||||
Reference in new issue
Block a user