feat: debug mode env variable (#1450)
This commit is contained in:
parent
3b85f4b616
commit
5a3377790e
2 changed files with 12 additions and 5 deletions
|
|
@ -44,3 +44,6 @@ POSTMARK_TOKEN=
|
||||||
DRAWIO_URL=
|
DRAWIO_URL=
|
||||||
|
|
||||||
DISABLE_TELEMETRY=false
|
DISABLE_TELEMETRY=false
|
||||||
|
|
||||||
|
# Enable debug logging in production (default: false)
|
||||||
|
DEBUG_MODE=false
|
||||||
|
|
@ -12,10 +12,14 @@ export class InternalLogFilter extends ConsoleLogger {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.allowedLogLevels =
|
const isProduction = process.env.NODE_ENV === 'production';
|
||||||
process.env.NODE_ENV === 'production'
|
const isDebugMode = process.env.DEBUG_MODE === 'true';
|
||||||
? ['log', 'error', 'fatal']
|
|
||||||
: ['log', 'debug', 'verbose', 'warn', 'error', 'fatal'];
|
if (isProduction && !isDebugMode) {
|
||||||
|
this.allowedLogLevels = ['log', 'error', 'fatal'];
|
||||||
|
} else {
|
||||||
|
this.allowedLogLevels = ['log', 'debug', 'verbose', 'warn', 'error', 'fatal'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private isLogLevelAllowed(level: string): boolean {
|
private isLogLevelAllowed(level: string): boolean {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue