Files
decky-loader/frontend/src/logger.ts
T
AAGaming 6522ebf0ca Implement legacy & modern plugin method calls over WS
This version builds fine and runs all of the 14 plugins I have installed perfectly, so we're really close to having this done.
2023-12-30 00:46:59 -05:00

64 lines
1.2 KiB
TypeScript

export const log = (name: string, ...args: any[]) => {
console.log(
`%c Decky %c ${name} %c`,
'background: #16a085; color: black;',
'background: #1abc9c; color: black;',
'background: transparent;',
...args,
);
};
export const debug = (name: string, ...args: any[]) => {
console.debug(
`%c Decky %c ${name} %c`,
'background: #16a085; color: black;',
'background: #1abc9c; color: black;',
'color: blue;',
...args,
);
};
export const warn = (name: string, ...args: any[]) => {
console.warn(
`%c Decky %c ${name} %c`,
'background: #16a085; color: black;',
'background: #ffbb00; color: black;',
'color: blue;',
...args,
);
};
export const error = (name: string, ...args: any[]) => {
console.error(
`%c Decky %c ${name} %c`,
'background: #16a085; color: black;',
'background: #FF0000;',
'background: transparent;',
...args,
);
};
class Logger {
constructor(private name: string) {
this.name = name;
}
log(...args: any[]) {
log(this.name, ...args);
}
debug(...args: any[]) {
debug(this.name, ...args);
}
warn(...args: any[]) {
warn(this.name, ...args);
}
error(...args: any[]) {
error(this.name, ...args);
}
}
export default Logger;