feat: debug mode env variable (#1450)

This commit is contained in:
Philip Okugbe
2025-08-06 18:16:30 +01:00
committed by GitHub
parent 3b85f4b616
commit 5a3377790e
2 changed files with 12 additions and 5 deletions

View File

@ -43,4 +43,7 @@ POSTMARK_TOKEN=
# for custom drawio server
DRAWIO_URL=
DISABLE_TELEMETRY=false
DISABLE_TELEMETRY=false
# Enable debug logging in production (default: false)
DEBUG_MODE=false

View File

@ -12,10 +12,14 @@ export class InternalLogFilter extends ConsoleLogger {
constructor() {
super();
this.allowedLogLevels =
process.env.NODE_ENV === 'production'
? ['log', 'error', 'fatal']
: ['log', 'debug', 'verbose', 'warn', 'error', 'fatal'];
const isProduction = process.env.NODE_ENV === 'production';
const isDebugMode = process.env.DEBUG_MODE === 'true';
if (isProduction && !isDebugMode) {
this.allowedLogLevels = ['log', 'error', 'fatal'];
} else {
this.allowedLogLevels = ['log', 'debug', 'verbose', 'warn', 'error', 'fatal'];
}
}
private isLogLevelAllowed(level: string): boolean {