feat(logger): add info, warning, error, and critical methods
This commit is contained in:
parent
7ef841ac43
commit
50df6b4c37
1 changed files with 32 additions and 1 deletions
|
|
@ -1,8 +1,11 @@
|
|||
import {
|
||||
LogLevel,
|
||||
DEBUG,
|
||||
NOTSET,
|
||||
INFO,
|
||||
WARNING,
|
||||
ERROR,
|
||||
CRITICAL,
|
||||
NOTSET,
|
||||
checkLevel,
|
||||
} from './log-level';
|
||||
import {
|
||||
|
|
@ -173,6 +176,34 @@ export class Logger extends Filterer {
|
|||
if (this.isEnabledFor(DEBUG)) { this._log(DEBUG, msg, options) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Log 'msg % args' with severity 'INFO'
|
||||
*/
|
||||
public info(msg: string, options?: LogOptions) {
|
||||
if (this.isEnabledFor(INFO)) { this._log(INFO, msg, options) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Log 'msg % args' with severity 'WARNING'
|
||||
*/
|
||||
public warning(msg: string, options?: LogOptions) {
|
||||
if (this.isEnabledFor(WARNING)) { this._log(WARNING, msg, options) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Log 'msg % args' with severity 'ERROR'
|
||||
*/
|
||||
public error(msg: string, options?: LogOptions) {
|
||||
if (this.isEnabledFor(ERROR)) { this._log(ERROR, msg, options) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Log 'msg % args' with severity 'CRITICAL'
|
||||
*/
|
||||
public critical(msg: string, options?: LogOptions) {
|
||||
if (this.isEnabledFor(CRITICAL)) { this._log(CRITICAL, msg, options) }
|
||||
}
|
||||
|
||||
/**
|
||||
* A factory method which can be overriden in subclasses to create
|
||||
* specialized LogRecords.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue