From c9b6c56182750444b1cced3343b02eea6a9f24c5 Mon Sep 17 00:00:00 2001 From: "S. Amir Mohammad Najafi" Date: Sat, 3 Dec 2022 10:29:30 +0330 Subject: [PATCH 1/2] feat(logger): log incident in production mode --- packages/core/logger/src/logger.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/core/logger/src/logger.ts b/packages/core/logger/src/logger.ts index e878d0ded..470c3ccad 100644 --- a/packages/core/logger/src/logger.ts +++ b/packages/core/logger/src/logger.ts @@ -133,6 +133,10 @@ export const createLogger = (scope: string, color?: string | null, debug?: boole error: isBrowser ? console.error.bind(console, '%c%s%c.%s() Error `%s`\n', styleScope, scope, style.reset) : console.error.bind(console, `${styleScope}❌\n%s\x1b[31m.%s() Error \`%s\`${style.reset}\n`, scope), + + incident: isBrowser + ? console.log.bind(console, '%c%s%c.%s() Incident `%s` %s!', styleScope, scope, 'color: orange;') + : console.log.bind(console, `${styleScope}🚸\n%s${style.reset}.%s() Incident \`%s\` %s!${style.reset}`, scope), }; if (!debug) { @@ -142,7 +146,6 @@ export const createLogger = (scope: string, color?: string | null, debug?: boole logMethod: empty, logMethodArgs: empty, logMethodFull: empty, - incident: empty, logOther: empty, }; } @@ -159,10 +162,6 @@ export const createLogger = (scope: string, color?: string | null, debug?: boole logMethodFull: console.debug.bind(console, keySection + '.%s(%o) => %o', styleScope, scope, style.reset), - incident: isBrowser - ? console.log.bind(console, '%c%s%c.%s() Incident `%s` %s!', styleScope, scope, 'color: orange;') - : console.log.bind(console, `${styleScope}🚸\n%s${style.reset}.%s() Incident \`%s\` %s!${style.reset}`, scope), - logOther: console.debug.bind(console, keySection, styleScope, scope, style.reset), }; }; From 0e863506ee7c4cbfde7f5d62ad4a79c639716172 Mon Sep 17 00:00:00 2001 From: "S. Amir Mohammad Najafi" Date: Mon, 5 Dec 2022 17:31:45 +0330 Subject: [PATCH 2/2] chore(logger): review --- packages/core/logger/src/logger.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/core/logger/src/logger.ts b/packages/core/logger/src/logger.ts index 470c3ccad..26f55d906 100644 --- a/packages/core/logger/src/logger.ts +++ b/packages/core/logger/src/logger.ts @@ -126,6 +126,10 @@ export const createLogger = (scope: string, color?: string | null, debug?: boole color, scope, + incident: isBrowser + ? console.log.bind(console, '%c%s%c.%s() Incident `%s` %s!', styleScope, scope, 'color: orange;') + : console.log.bind(console, `${styleScope}🚸\n%s${style.reset}.%s() Incident \`%s\` %s!${style.reset}`, scope), + accident: isBrowser ? console.warn.bind(console, '%c%s%c.%s() Accident `%s` %s!', styleScope, scope, style.reset) : console.warn.bind(console, `${styleScope}⚠️\n%s\x1b[33m.%s() Accident \`%s\` %s!${style.reset}`, scope), @@ -133,10 +137,6 @@ export const createLogger = (scope: string, color?: string | null, debug?: boole error: isBrowser ? console.error.bind(console, '%c%s%c.%s() Error `%s`\n', styleScope, scope, style.reset) : console.error.bind(console, `${styleScope}❌\n%s\x1b[31m.%s() Error \`%s\`${style.reset}\n`, scope), - - incident: isBrowser - ? console.log.bind(console, '%c%s%c.%s() Incident `%s` %s!', styleScope, scope, 'color: orange;') - : console.log.bind(console, `${styleScope}🚸\n%s${style.reset}.%s() Incident \`%s\` %s!${style.reset}`, scope), }; if (!debug) {