Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

Commit

Permalink
feat(logger): remove desc from incident & accident
Browse files Browse the repository at this point in the history
BREAKING CHANGE: remove desc from incident & accident
  • Loading branch information
AliMD committed Oct 23, 2023
1 parent e7a7236 commit fa38b68
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions packages/logger/src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ export const createLogger = (domain: string, devMode = DEV_MODE): AlwatrLogger =
'font-size: 2rem; background-color: #5858e8; color: #fff; padding: 1rem 4rem; border-radius: 0.5rem;'),

accident: NODE_MODE
? console.warn.bind(console, `${styleScope}⚠️\n%s\x1b[33m.%s() Accident \`%s\` %s!${_style.reset}`, domain)
: console.warn.bind(console, '%c%s%c.%s() Accident `%s` %s!', styleScope, domain, _style.reset),
? console.warn.bind(console, `${styleScope}⚠️\n%s\x1b[33m.%s() Accident \`%s\`!${_style.reset}`, domain)
: console.warn.bind(console, '%c%s%c.%s() Accident `%s`!', styleScope, domain, _style.reset),

error: NODE_MODE
? console.error.bind(console, `${styleScope}❌\n%s\x1b[31m.%s() Error \`%s\`${_style.reset}\n`, domain)
Expand All @@ -113,8 +113,8 @@ export const createLogger = (domain: string, devMode = DEV_MODE): AlwatrLogger =
logOther: console.debug.bind(console, _keySection, styleScope, domain, _style.reset),

incident: NODE_MODE
? console.log.bind(console, `${styleScope}🚸\n%s${_style.reset}.%s() Incident \`%s\` %s!${_style.reset}`, domain)
: console.log.bind(console, '%c%s%c.%s() Incident `%s` %s!', styleScope, domain, 'color: orange;'),
? console.log.bind(console, `${styleScope}🚸\n%s${_style.reset}.%s() Incident \`%s\`!${_style.reset}`, domain)
: console.log.bind(console, '%c%s%c.%s() Incident `%s`!', styleScope, domain, 'color: orange;'),

time: (label: string) => console.time(domain + '.' + label + ' duration time'),
timeEnd: (label: string) => console.timeEnd(domain + '.' + label + ' duration time'),
Expand Down
4 changes: 2 additions & 2 deletions packages/logger/src/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export interface AlwatrLogger {
* logger.incident?.('fetch', 'abort_signal', 'aborted signal received', {url: '/test.json'});
* ```
*/
incident?(method: string, code: string, desc: string, ...args: unknown[]): void;
incident?(method: string, code: string, ...args: unknown[]): void;

/**
* `console.warn` an unexpected accident or error that you handled like warning.
Expand All @@ -93,7 +93,7 @@ export interface AlwatrLogger {
* logger.accident('fetch', 'file_not_found', 'url requested return 404 not found', {url: '/test.json'});
* ```
*/
accident(method: string, code: string, desc: string, ...args: unknown[]): void;
accident(method: string, code: string, ...args: unknown[]): void;

/**
* `console.error` an unexpected error.
Expand Down

0 comments on commit fa38b68

Please sign in to comment.