Move packages/apps back
This commit is contained in:
parent
6eaaf8e9be
commit
5535d6b575
348 changed files with 0 additions and 0 deletions
22
packages/metamigo-common/logger.ts
Normal file
22
packages/metamigo-common/logger.ts
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
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);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue