From 04c84d55f7c0a0cd2fe47293998fc7c6170da5f8 Mon Sep 17 00:00:00 2001 From: DitFranXX Date: Fri, 28 May 2021 00:56:49 +0900 Subject: [PATCH] feat: :loud_sound: Support logger for more level --- gitadora@asphyxia/utils/logger.ts | 37 +++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/gitadora@asphyxia/utils/logger.ts b/gitadora@asphyxia/utils/logger.ts index 94fddb1..254ff74 100644 --- a/gitadora@asphyxia/utils/logger.ts +++ b/gitadora@asphyxia/utils/logger.ts @@ -7,14 +7,51 @@ export default class Logger { this.category = (category == null) ? null : `[${category}]` } + public error(...args: any[]) { this.argsHandler(console.error, ...args) } + public debugError(...args: any[]) { + if (isAsphyxiaDebugMode()) { + this.argsHandler(console.error, ...args) + } + } + + + public warn(...args: any[]) { + this.argsHandler(console.warn, ...args) + } + + public debugWarn(...args: any[]) { if (isAsphyxiaDebugMode()) { this.argsHandler(console.warn, ...args) } } + + + public info(...args: any[]) { + this.argsHandler(console.info, ...args) + } + + public debugInfo(...args: any[]) { + if (isAsphyxiaDebugMode()) { + this.argsHandler(console.info, ...args) + } + } + + + public log(...args: any[]) { + this.argsHandler(console.log, ...args) + } + + public debugLog(...args: any[]) { + if (isAsphyxiaDebugMode()) { + this.argsHandler(console.log, ...args) + } + } + + private argsHandler(target: Function, ...args: any[]) { if (this.category == null) { target(...args)