balabola-vk/src/logger.ts

21 lines
527 B
TypeScript

import pino, { LoggerOptions } from "pino";
import PinoPretty, { PrettyOptions } from "pino-pretty";
import { env } from "./env";
const options: LoggerOptions = {
level: env.LOG_LEVEL
};
const prettyOptions: PrettyOptions = {
ignore: 'pid,hostname',
colorize: env.isDev ? true : false,
translateTime: 'SYS:dd-mm-yyyy, HH:MM:ss'
};
export let rawLogger = pino(options);
if (env.isDev) {
rawLogger = pino(options, PinoPretty(prettyOptions));
}
export const logger = rawLogger.child({ name: 'balabola' });