From 1c8f61c682e7cb0f723b298773c66d2ecc5de7db Mon Sep 17 00:00:00 2001 From: Tormak <63308171+Tormak9970@users.noreply.github.com> Date: Sat, 9 Sep 2023 13:06:31 -0400 Subject: [PATCH] fix: added frontend logging to log controller --- src/lib/controllers/LogController.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/lib/controllers/LogController.ts b/src/lib/controllers/LogController.ts index 9154d999..9698fa4d 100644 --- a/src/lib/controllers/LogController.ts +++ b/src/lib/controllers/LogController.ts @@ -33,6 +33,15 @@ export class LogController { * @param message Message to log. */ static async log(message:string): Promise { + if (IS_DEBUG) { + console.log( + `%c SARM %c INFO %c`, + 'background: #04e200; color: black;', + 'background: #1abc9c; color: black;', + 'background: transparent;', + message + ); + } await RustInterop.logToCoreFile(message, LogLevel.INFO); } @@ -41,6 +50,15 @@ export class LogController { * @param message Message to log. */ static async warn(message:string): Promise { + if (IS_DEBUG) { + console.warn( + `%c SARM %c WARNING %c`, + 'background: #04e200; color: black;', + 'background: #e3c907; color: black;', + 'background: transparent;', + message + ); + } await RustInterop.logToCoreFile(message, LogLevel.WARN); } @@ -49,6 +67,15 @@ export class LogController { * @param message Message to log. */ static async error(message:string): Promise { + if (IS_DEBUG) { + console.error( + `%c SARM %c ERROR %c`, + 'background: #04e200; color: black;', + 'background: #c70808; color: black;', + 'background: transparent;', + message + ); + } await RustInterop.logToCoreFile(message, LogLevel.ERROR); }