metamigo-common: fix pretty deprecation error in pino logging

This commit is contained in:
Abel Luck 2023-06-06 09:03:10 +00:00
parent 9c7a385c77
commit a33f80c497
3 changed files with 6 additions and 10 deletions

View file

@ -1,20 +1,15 @@
import pino, { LoggerOptions } from "pino";
import { IMetamigoConfig } from "./config/index.js";
export const getPrettyPrint = <T extends IMetamigoConfig>(
config: T
): boolean => {
const { prettyPrint } = config.logging;
if (prettyPrint === "auto") return config?.isDev || false;
return prettyPrint === true;
};
export const configureLogger = <T extends IMetamigoConfig>(
config: T
): pino.Logger => {
const { level, redact } = config.logging;
const options: LoggerOptions = {
level,
transport: {
target: "pino-pretty",
},
redact: {
paths: redact,
remove: true,