mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-08-05 12:56:42 +02:00
Refactor BxLogger
This commit is contained in:
17
dist/better-xcloud.lite.user.js
vendored
17
dist/better-xcloud.lite.user.js
vendored
@@ -12,18 +12,11 @@
|
|||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
"use strict";
|
"use strict";
|
||||||
class BxLogger {
|
class BxLogger {
|
||||||
static #PREFIX = "[BxC]";
|
static info = (tag, ...args) => BxLogger.log("#008746", tag, ...args);
|
||||||
static info(tag, ...args) {
|
static warning = (tag, ...args) => BxLogger.log("#c1a404", tag, ...args);
|
||||||
BxLogger.#log("#008746", tag, ...args);
|
static error = (tag, ...args) => BxLogger.log("#c10404", tag, ...args);
|
||||||
}
|
static log(color, tag, ...args) {
|
||||||
static warning(tag, ...args) {
|
console.log("%c[BxC]", `color:${color};font-weight:bold;`, tag, "//", ...args);
|
||||||
BxLogger.#log("#c1a404", tag, ...args);
|
|
||||||
}
|
|
||||||
static error(tag, ...args) {
|
|
||||||
BxLogger.#log("#c10404", tag, ...args);
|
|
||||||
}
|
|
||||||
static #log(color, tag, ...args) {
|
|
||||||
console.log(`%c${BxLogger.#PREFIX}`, `color:${color};font-weight:bold;`, tag, "//", ...args);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
window.BxLogger = BxLogger;
|
window.BxLogger = BxLogger;
|
||||||
|
17
dist/better-xcloud.user.js
vendored
17
dist/better-xcloud.user.js
vendored
@@ -14,18 +14,11 @@
|
|||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
"use strict";
|
"use strict";
|
||||||
class BxLogger {
|
class BxLogger {
|
||||||
static #PREFIX = "[BxC]";
|
static info = (tag, ...args) => BxLogger.log("#008746", tag, ...args);
|
||||||
static info(tag, ...args) {
|
static warning = (tag, ...args) => BxLogger.log("#c1a404", tag, ...args);
|
||||||
BxLogger.#log("#008746", tag, ...args);
|
static error = (tag, ...args) => BxLogger.log("#c10404", tag, ...args);
|
||||||
}
|
static log(color, tag, ...args) {
|
||||||
static warning(tag, ...args) {
|
console.log("%c[BxC]", `color:${color};font-weight:bold;`, tag, "//", ...args);
|
||||||
BxLogger.#log("#c1a404", tag, ...args);
|
|
||||||
}
|
|
||||||
static error(tag, ...args) {
|
|
||||||
BxLogger.#log("#c10404", tag, ...args);
|
|
||||||
}
|
|
||||||
static #log(color, tag, ...args) {
|
|
||||||
console.log(`%c${BxLogger.#PREFIX}`, `color:${color};font-weight:bold;`, tag, "//", ...args);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
window.BxLogger = BxLogger;
|
window.BxLogger = BxLogger;
|
||||||
|
@@ -5,22 +5,12 @@ const enum TextColor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class BxLogger {
|
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 info(tag: string, ...args: any[]) {
|
private static log(color: string, tag: string, ...args: any) {
|
||||||
BxLogger.#log(TextColor.INFO, tag, ...args);
|
console.log(`%c[BxC]`, `color:${color};font-weight:bold;`, 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: string, tag: string, ...args: any) {
|
|
||||||
console.log(`%c${BxLogger.#PREFIX}`, `color:${color};font-weight:bold;`, tag, '//', ...args);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user