Refactor metamigo-common

This commit is contained in:
Abel Luck 2023-03-13 11:12:50 +00:00
parent cae0071851
commit b3d8c3918e
32 changed files with 5 additions and 14 deletions

View file

@ -1,22 +0,0 @@
import pino, { LoggerOptions } from "pino";
import { IMetamigoConfig } from "./config";
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,
redact: {
paths: redact,
remove: true,
},
};
return pino(options);
};