Skip to content

Commit

Permalink
simplify logger
Browse files Browse the repository at this point in the history
  • Loading branch information
therealmarv committed Nov 18, 2024
1 parent 326ce34 commit 2dbc39f
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/lib/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,17 @@ import debug from 'debug'
const logger = {
debug: debug('app:debug'),
info: debug('app:info'),
warn: (...args: unknown[]) => {
debug('app:warn')(...args)
console.warn('[WARN]', ...args)
},
error: (...args: unknown[]) => {
debug('app:error')(...args)
console.error('[ERROR]', ...args)
},
warn: debug('app:warn'),
error: debug('app:error'),
}

// Enable debug output in development
if (process.env.NODE_ENV === 'development') {
debug.enable('app:*')
}

// Forward warnings and errors to console
logger.warn.log = console.warn.bind(console)
logger.error.log = console.error.bind(console)

export default logger

0 comments on commit 2dbc39f

Please sign in to comment.