feat: add @tower/logger package
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import pino from 'pino';
|
||||
|
||||
export function createLogger(name: string) {
|
||||
return pino({
|
||||
name,
|
||||
level: process.env['LOG_LEVEL'] ?? 'info',
|
||||
...(process.env['NODE_ENV'] !== 'production' && {
|
||||
transport: {
|
||||
target: 'pino-pretty',
|
||||
options: { colorize: true },
|
||||
},
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
export type Logger = ReturnType<typeof createLogger>;
|
||||
Reference in New Issue
Block a user