move debug log filtering from debug() to log() for consistency
This commit is contained in:
parent
ed3dd81b4b
commit
bc722ea06d
1 changed files with 6 additions and 3 deletions
|
|
@ -72,6 +72,11 @@ export default class Logger {
|
||||||
private log(level: Level, message: string, data?: Data, important = false, subContexts: Context[] = []): void {
|
private log(level: Level, message: string, data?: Data, important = false, subContexts: Context[] = []): void {
|
||||||
if (this.envService.options.quiet) return;
|
if (this.envService.options.quiet) return;
|
||||||
|
|
||||||
|
// Debugging logging is disabled in production unless MK_VERBOSE is set.
|
||||||
|
if (level === 'debug' && process.env.NODE_ENV === 'production' && !this.envService.options.verbose) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.parentLogger) {
|
if (this.parentLogger) {
|
||||||
this.parentLogger.log(level, message, data, important, [this.context].concat(subContexts));
|
this.parentLogger.log(level, message, data, important, [this.context].concat(subContexts));
|
||||||
return;
|
return;
|
||||||
|
|
@ -138,9 +143,7 @@ export default class Logger {
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public debug(message: string, data?: Data, important = false): void { // デバッグ用に使う(開発者に必要だが利用者に不要な情報)
|
public debug(message: string, data?: Data, important = false): void { // デバッグ用に使う(開発者に必要だが利用者に不要な情報)
|
||||||
if (process.env.NODE_ENV !== 'production' || this.envService.options.verbose) {
|
this.log('debug', message, data, important);
|
||||||
this.log('debug', message, data, important);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue