Skip to content

Commit

Permalink
fix: added frontend logging to log controller
Browse files Browse the repository at this point in the history
  • Loading branch information
Tormak9970 committed Sep 9, 2023
1 parent ddfbe96 commit 1c8f61c
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/lib/controllers/LogController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ export class LogController {
* @param message Message to log.
*/
static async log(message:string): Promise<void> {
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);
}

Expand All @@ -41,6 +50,15 @@ export class LogController {
* @param message Message to log.
*/
static async warn(message:string): Promise<void> {
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);
}

Expand All @@ -49,6 +67,15 @@ export class LogController {
* @param message Message to log.
*/
static async error(message:string): Promise<void> {
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);
}

Expand Down

0 comments on commit 1c8f61c

Please sign in to comment.