优化:降低访问日志噪声并增加日志文件轮转
This commit is contained in:
@@ -77,6 +77,16 @@ test('resolveExpiredLogFilenames supports explicit retention days', () => {
|
||||
assert.deepEqual(expired, ['app-2026-04-07.log'])
|
||||
})
|
||||
|
||||
test('resolveExpiredLogFilenames includes rotated files', () => {
|
||||
const expired = resolveExpiredLogFilenames(
|
||||
['app-2026-04-14.1.log', 'app-2026-04-07.5.log', 'app-2026-04-14.log'],
|
||||
'2026-04-14',
|
||||
7,
|
||||
)
|
||||
|
||||
assert.deepEqual(expired, ['app-2026-04-07.5.log'])
|
||||
})
|
||||
|
||||
test('formatLogTimestamp renders readable local timestamp with timezone offset', () => {
|
||||
const rendered = formatLogTimestamp('2026-04-14T10:36:24.974Z')
|
||||
assert.match(rendered, /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3} [+-]\d{2}:\d{2}$/)
|
||||
|
||||
Reference in New Issue
Block a user