Skip to content

Commit

Permalink
Fix log files not rotated (#487)
Browse files Browse the repository at this point in the history
Regex escape codes need second escape due to conversion to string template.
  • Loading branch information
webfiltered authored Dec 14, 2024
1 parent 5c55ed8 commit 34f8457
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 34f8457

Please sign in to comment.