mirror of
https://github.com/FJurmanovic/sugarr.git
synced 2026-11-11 07:41:08 +00:00
Scaffold TypeScript project and add core logger
This commit is contained in:
12
src/core/logging/logger.ts
Normal file
12
src/core/logging/logger.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import pino from 'pino';
|
||||
|
||||
export type Logger = pino.Logger;
|
||||
|
||||
export function createLogger(name: string): Logger {
|
||||
const isProduction = process.env.NODE_ENV === 'production';
|
||||
return pino({
|
||||
name,
|
||||
level: process.env.LOG_LEVEL ?? 'info',
|
||||
transport: isProduction ? undefined : { target: 'pino-pretty' },
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user