Skip to content

Commit

Permalink
Merge pull request #458 from AliMD/feat/logger
Browse files Browse the repository at this point in the history
feat(logger): log incident in production mode
  • Loading branch information
alimd authored Dec 5, 2022
2 parents 6509cf8 + 0e86350 commit 764d841
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/core/logger/src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -142,7 +146,6 @@ export const createLogger = (scope: string, color?: string | null, debug?: boole
logMethod: empty,
logMethodArgs: empty,
logMethodFull: empty,
incident: empty,
logOther: empty,
};
}
Expand All @@ -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),
};
};

0 comments on commit 764d841

Please sign in to comment.