feat: add custom pino logger

This commit is contained in:
Ritesh Ghosh
2025-05-11 13:07:17 +05:30
parent 5e028771f0
commit b6288a02d8
+26
View File
@@ -0,0 +1,26 @@
import { env } from "./env.js";
import { pino, type LoggerOptions } from "pino";
const loggerOptions: LoggerOptions = {
redact: env.isProduction ? ["hostname"] : [],
level: "info",
transport: env.isDev
? {
target: "pino-pretty",
options: {
colorize: true,
translateTime: "SYS:standard",
},
}
: undefined,
formatters: {
level(label) {
return {
level: label.toUpperCase(),
};
},
},
timestamp: pino.stdTimeFunctions.isoTime,
};
export const logger = pino(loggerOptions);