Skip to content

Commit

Permalink
fix: log deletion in prod
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards1230 committed May 16, 2024
1 parent 3e97279 commit 92cc646
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tooling/logger/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import fs from "fs";
import path from "path";

export const isProd = process.env.NODE_ENV === "production";

export function purgeLogFiles(logsDir: string) {
if (!isProd) {
return;
}

// Ensure the directory exists
fs.mkdirSync(logsDir, { recursive: true });

// Purge all log files
fs.rmSync(logsDir, { recursive: true, force: true });
}

0 comments on commit 92cc646

Please sign in to comment.