neko/src/component/utils/logger.ts
Miroslav Šedivý ed197d5c76 logging changed.
2021-01-15 17:17:49 +01:00

26 lines
726 B
TypeScript

export class Logger {
private _scope: string = 'main'
constructor(scope?: string) {
if (scope) {
this._scope = scope
}
}
public error(error: Error) {
console.error('[%cNEKO%c] [' + this._scope + '] %cERR', 'color: #498ad8;', '', 'color: #d84949;', error)
}
public warn(...log: any[]) {
console.warn('[%cNEKO%c] [' + this._scope + '] %cWRN', 'color: #498ad8;', '', 'color: #eae364;', ...log)
}
public info(...log: any[]) {
console.info('[%cNEKO%c] [' + this._scope + '] %cINF', 'color: #498ad8;', '', 'color: #4ac94c;', ...log)
}
public debug(...log: any[]) {
console.debug('[%cNEKO%c] [' + this._scope + '] %cDBG', 'color: #498ad8;', '', 'color: #eae364;', ...log)
}
}