mirror of
https://github.com/DerTyp7/teamspeak-obs-overlay.git
synced 2025-10-29 21:02:10 +01:00
[feature] update logger parameters
This commit is contained in:
@@ -1,31 +1,31 @@
|
|||||||
export default class Logger {
|
export default class Logger {
|
||||||
// Log message to the console
|
// Log message to the console
|
||||||
public static log(message: string): void {
|
public static log(message: string, data: object | null = null): void {
|
||||||
console.log(`%c${message}`, "color: gray");
|
console.log(`%c${message}`.trim(), "color: gray", data ?? "");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log warning to the console
|
// Log warning to the console
|
||||||
public static warn(message: string): void {
|
public static warn(message: string, data: object | null = null): void {
|
||||||
console.warn(`%c${message}`);
|
console.warn(`%c${message}`.trim(), data ?? "");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log error to the console
|
// Log error to the console
|
||||||
public static error(message: string): void {
|
public static error(message: string, data: object | null = null): void {
|
||||||
console.error(`%c${message}`);
|
console.error(`%c${message}`.trim(), data ?? "");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log message received from the websocket to the console
|
// Log message received from the websocket to the console
|
||||||
public static wsRecieved(wsData: object): void {
|
public static wsReicved(data: object, message: string | undefined = undefined): void {
|
||||||
console.log(`%c[WS Recieved]`, "color: #683dad", wsData);
|
console.log(`%c[WS Recieved] ${message ?? ""}`.trim(), "color: #8258c7", data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log message sent to the websocket to the console
|
// Log message sent to the websocket to the console
|
||||||
public static wsSent(wsData: object): void {
|
public static wsSent(data: object, message: string | undefined = undefined): void {
|
||||||
console.log(`%c[WS Sent]`, "color: #4eb570", wsData);
|
console.log(`%c[WS Sent] ${message ?? ""}`.trim(), "color: #4eb570", data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log message to the console with a timestamp
|
// Log message to the console with a timestamp
|
||||||
public static ts(message: string): void {
|
public static ts(message: string, data: object | null = null): void {
|
||||||
console.log(`%c[TS] ${message}`, "color: #2e6bc7");
|
console.log(`%c[TS] ${message}`.trim(), "color: #2e6bc7", data ?? "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user