From 34f845771e2e045c771438259810609f0bb5c58d Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Sun, 15 Dec 2024 06:44:27 +1100 Subject: [PATCH] Fix log files not rotated (#487) Regex escape codes need second escape due to conversion to string template. --- src/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils.ts b/src/utils.ts index 569ef4d1..b637cde0 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -71,7 +71,7 @@ export async function rotateLogFiles(logDir: string, baseName: string, maxFiles const files = await fsPromises.readdir(logDir, { withFileTypes: true }); const names: string[] = []; - const logFileRegex = new RegExp(`^${baseName}_\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}-\d{3}Z\.log$`); + const logFileRegex = new RegExp(`^${baseName}_\\d{4}-\\d{2}-\\d{2}T\\d{2}-\\d{2}-\\d{2}-\\d{3}Z\\.log$`); for (const file of files) { if (file.isFile() && logFileRegex.test(file.name)) names.push(file.name);