feat(logger): add info, warning, error, and critical methods

This commit is contained in:
Tiara Rodney 2026-03-13 22:55:17 +01:00
parent 7ef841ac43
commit 50df6b4c37
No known key found for this signature in database
GPG key ID: 5CD8EC1D46106723

View file

@ -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.