Spaces:
Sleeping
Sleeping
File size: 421 Bytes
b608851 a2745d4 b608851 a2745d4 b608851 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | import pino from 'pino'
function hasPinoPretty(): boolean {
try {
require.resolve('pino-pretty')
return true
} catch {
return false
}
}
const usePretty = process.env.NODE_ENV !== 'production' && hasPinoPretty()
export const logger = pino({
level: process.env.LOG_LEVEL || 'info',
...(usePretty && {
transport: {
target: 'pino-pretty',
options: { colorize: true },
},
}),
})
|