[feature] created Logger

This commit is contained in:
Janis
2023-06-29 18:09:03 +02:00
parent c6289ddc0f
commit 619e66375f
2 changed files with 34 additions and 0 deletions

31
src/utils/logger.tsx Normal file
View File

@@ -0,0 +1,31 @@
export default class Logger {
// Log message to the console
public static log(message: string): void {
console.log(`%c${message}`, "color: gray");
}
// Log warning to the console
public static warn(message: string): void {
console.warn(`%c${message}`);
}
// Log error to the console
public static error(message: string): void {
console.error(`%c${message}`);
}
// Log message received from the websocket to the console
public static wsRecieved(wsData: object): void {
console.log(`%c[WS Recieved]`, "color: #683dad", wsData);
}
// Log message sent to the websocket to the console
public static wsSent(wsData: object): void {
console.log(`%c[WS Sent]`, "color: #4eb570", wsData);
}
// Log message to the console with a timestamp
public static ts(message: string): void {
console.log(`%c[TS] ${message}`, "color: #2e6bc7");
}
}