UNPKG

@flowlab/all

Version:

A cool library focusing on handling various flows

19 lines (17 loc) 644 B
// src/utils/logger.ts import pino, { Logger, LoggerOptions } from 'pino'; const defaultOptions: LoggerOptions = { level: process.env.LOG_LEVEL || 'info', // Use pino-pretty for development, json for production transport: process.env.NODE_ENV !== 'production' ? { target: 'pino-pretty', options: { colorize: true, ignore: 'pid,hostname', // Optional: clean up output translateTime: 'SYS:standard', // More readable timestamp } } : undefined, }; export function createLogger(options: LoggerOptions = {}): Logger { return pino({ ...defaultOptions, ...options }); }