neko/src/component/utils/logger.ts

26 lines
726 B
TypeScript
Raw Normal View History

2020-11-06 05:15:21 +13:00
export class Logger {
private _scope: string = 'main'
constructor(scope?: string) {
2020-11-06 05:20:37 +13:00
if (scope) {
2020-11-06 05:15:21 +13:00
this._scope = scope
}
}
public error(error: Error) {
2020-11-06 05:20:37 +13:00
console.error('[%cNEKO%c] [' + this._scope + '] %cERR', 'color: #498ad8;', '', 'color: #d84949;', error)
2020-11-06 05:15:21 +13:00
}
public warn(...log: any[]) {
2020-11-06 05:20:37 +13:00
console.warn('[%cNEKO%c] [' + this._scope + '] %cWRN', 'color: #498ad8;', '', 'color: #eae364;', ...log)
2020-11-06 05:15:21 +13:00
}
public info(...log: any[]) {
2020-11-06 05:20:37 +13:00
console.info('[%cNEKO%c] [' + this._scope + '] %cINF', 'color: #498ad8;', '', 'color: #4ac94c;', ...log)
2020-11-06 05:15:21 +13:00
}
public debug(...log: any[]) {
2021-01-16 05:17:49 +13:00
console.debug('[%cNEKO%c] [' + this._scope + '] %cDBG', 'color: #498ad8;', '', 'color: #eae364;', ...log)
2020-11-06 05:15:21 +13:00
}
}