From 50df6b4c37594cdbdf13e1f56ee7e519d99fb33d Mon Sep 17 00:00:00 2001 From: Tiara Rodney Date: Fri, 13 Mar 2026 22:55:17 +0100 Subject: [PATCH] feat(logger): add info, warning, error, and critical methods --- src/logger.ts | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/logger.ts b/src/logger.ts index 572f3a3..f43d18d 100644 --- a/src/logger.ts +++ b/src/logger.ts @@ -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.