mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-08-05 20:58:27 +02:00
Create BxLogger to show colored logs
This commit is contained in:
27
src/utils/bx-logger.ts
Normal file
27
src/utils/bx-logger.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
enum TextColor {
|
||||
INFO = '#008746',
|
||||
WARNING = '#c1a404',
|
||||
ERROR = '#c10404',
|
||||
}
|
||||
|
||||
export class BxLogger {
|
||||
static #PREFIX = '[BxC]';
|
||||
|
||||
static info(tag: string, ...args: any[]) {
|
||||
BxLogger.#log(TextColor.INFO, tag, ...args);
|
||||
}
|
||||
|
||||
static warning(tag: string, ...args: any[]) {
|
||||
BxLogger.#log(TextColor.WARNING, tag, ...args);
|
||||
}
|
||||
|
||||
static error(tag: string, ...args: any[]) {
|
||||
BxLogger.#log(TextColor.ERROR, tag, ...args);
|
||||
}
|
||||
|
||||
static #log(color: TextColor, tag: string, ...args: any) {
|
||||
console.log('%c' + BxLogger.#PREFIX, 'color:' + color + ';font-weight:bold;', tag, '-', ...args);
|
||||
}
|
||||
}
|
||||
|
||||
(window as any).BxLogger = BxLogger;
|
Reference in New Issue
Block a user