Initial commit
This commit is contained in:
15
api/utils/logger.ts
Normal file
15
api/utils/logger.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
type LogFn = (...args: unknown[]) => void
|
||||
|
||||
const createLogger = () => {
|
||||
const isProd = process.env.NODE_ENV === 'production'
|
||||
|
||||
const debug: LogFn = isProd ? () => {} : console.debug.bind(console)
|
||||
const info: LogFn = console.info.bind(console)
|
||||
const warn: LogFn = console.warn.bind(console)
|
||||
const error: LogFn = console.error.bind(console)
|
||||
|
||||
return { debug, info, warn, error }
|
||||
}
|
||||
|
||||
export const logger = createLogger()
|
||||
|
||||
Reference in New Issue
Block a user