21 lines
421 B
TypeScript
21 lines
421 B
TypeScript
import pino from "pino";
|
|
|
|
const isProduction = process.env.NODE_ENV === "production";
|
|
|
|
export const logger = pino({
|
|
level: process.env.LOG_LEVEL ?? "info",
|
|
redact: [
|
|
"req.headers.authorization",
|
|
"req.headers.cookie",
|
|
"res.headers['set-cookie']",
|
|
],
|
|
...(isProduction
|
|
? {}
|
|
: {
|
|
transport: {
|
|
target: "pino-pretty",
|
|
options: { colorize: true },
|
|
},
|
|
}),
|
|
});
|