import pino, { LoggerOptions } from "pino";
import { IMetamigoConfig } from "./config/index.js";

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,
    },
  };
  return pino(options);
};
