diff --git a/src/lib/logger.ts b/src/lib/logger.ts index 1f07b68..4f99709 100644 --- a/src/lib/logger.ts +++ b/src/lib/logger.ts @@ -3,14 +3,8 @@ 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 @@ -18,4 +12,8 @@ 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