mirror of
https://github.com/docmost/docmost.git
synced 2025-11-10 04:12:05 +10:00
feat: debug mode env variable (#1450)
This commit is contained in:
@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user