chore: add pino and pino-pretty for logging functionality

This commit is contained in:
ngc2207 2024-12-01 20:32:12 +08:00
parent 88229a3057
commit 8dc72f7e29
2 changed files with 18 additions and 0 deletions

View File

@ -13,6 +13,8 @@
"clsx": "^2.1.1",
"lucide-react": "^0.462.0",
"next": "15.0.3",
"pino": "^9.5.0",
"pino-pretty": "^13.0.0",
"react": "19.0.0-rc-66855b96-20241106",
"react-dom": "19.0.0-rc-66855b96-20241106",
"tailwind-merge": "^2.5.5",

16
src/lib/logger.ts Normal file
View File

@ -0,0 +1,16 @@
import pino, { Logger } from "pino";
const logger: Logger = pino({
level: process.env.PINO_LOG_LEVEL || "info",
transport: {
target: "pino-pretty",
options: {
colorize: true,
translateTime: "SYS:standard",
ignore: "pid,hostname",
},
},
redact: ["password", "secret", "token"],
});
export default logger;