feat: implement logging and retry mechanism with pino and p-retry

This commit is contained in:
MythEclipse
2026-05-13 16:25:01 +07:00
parent 9497e721e0
commit 3ae28157a3
7 changed files with 144 additions and 65 deletions
+22
View File
@@ -0,0 +1,22 @@
import pino from "pino";
const isDev = process.env.NODE_ENV !== "production";
export const logger = pino({
level: process.env.LOG_LEVEL || (isDev ? "debug" : "info"),
transport: isDev
? {
target: "pino-pretty",
options: {
colorize: true,
translateTime: "SYS:standard",
ignore: "pid,hostname",
},
}
: undefined,
timestamp: pino.stdTimeFunctions.isoTime,
});
export const createChildLogger = (context: string) => {
return logger.child({ context });
};