Skip to content

Commit 5cb1786

Browse files
committed
Change error formatting and extend error handling with optional support for error info object
1 parent 730ac46 commit 5cb1786

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Logger.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export type LogInfo = {
22
code: string;
33
message: string;
4+
error?: any;
45
};
56

67
const disabledLogs: {
@@ -20,7 +21,7 @@ export function logMessage(type: string, info: LogInfo): void {
2021
break;
2122
case 'error':
2223
if (!disabledLogs.errors) {
23-
console.log(`%c${info.code}:%c ${info.message}`, 'background: red; color: white', 'color: red');
24+
console.error(`%c${info.code}:%c ${info.message}`, info.error || '');
2425
}
2526
break;
2627
default:

0 commit comments

Comments
 (0)