fix(logging): harden file level configuration

Make persisted log filtering predictable across supported startup settings while rejecting configurations that could silently retain more data than intended.

Keep the first WebUI login credential available without weakening normal log thresholds, clarify the operator-facing behavior, and strengthen regression coverage across isolated environments and explicit file-output disablement.
This commit is contained in:
DrSmoothl committed 2026-07-30 10:27:43 +08:00
1 parent 227a62f2ad
commit 655226d9d7
6 files changed
+212 -181

No files matched your search

+10 -2
View File
@@ -6,7 +6,15 @@ import {
configureFileTransport,
getLogStorageStatus,
} from '@snowluma/common/log-file-transport';
import { createLogger, getLogLevel, getRecentLogs, LOG_LEVELS, setLogLevel, subscribeLogs } from '@snowluma/common/logger';
import {
createLogger,
getLogLevel,
getRecentLogs,
logInitialWebuiCredentials,
LOG_LEVELS,
setLogLevel,
subscribeLogs,
} from '@snowluma/common/logger';
import {
loadOneBotConfig,
OneBotConfigValidationError,
@@ -489,7 +497,7 @@ export async function initWebUI(
log.info(' 若跳过初始改密,下次启动将自动生成新的随机密码。');
log.info(' Log in and change the password now; it will not be shown again.');
log.info('────────────────────────────────────────────────────────────────');
log.info('initial credentials: user=admin password=%s', initialPassword);
logInitialWebuiCredentials(initialPassword);
log.info('════════════════════════════════════════════════════════════════');
} else if (auth.mustChangePassword()) {
log.warn('password change is still required');