19aeb2ba04
CI / Lint (push) Successful in 3m4s
CI / Typecheck (push) Successful in 3m6s
CI / Architecture Guardrails (push) Successful in 3m8s
CI / Assistant Split Regression (push) Successful in 3m48s
CI / Build (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
CI / Fresh-Linux Docker Deploy (push) Has been cancelled
CI / Release Images (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
rename(phase 3): compose/DB/infra + stray code refs capakraken → nexus (#62) Co-authored-by: Hartmut Nörenberg <hn@hartmut-noerenberg.com> Co-committed-by: Hartmut Nörenberg <hn@hartmut-noerenberg.com>
65 lines
1.3 KiB
TypeScript
65 lines
1.3 KiB
TypeScript
import pino from "pino";
|
|
|
|
const isProduction = process.env["NODE_ENV"] === "production";
|
|
|
|
const LOG_LEVEL = process.env["LOG_LEVEL"] ?? "info";
|
|
const devDestination = pino.destination({ dest: 1, sync: true });
|
|
|
|
const REDACT_PATHS = [
|
|
"password",
|
|
"*.password",
|
|
"*.*.password",
|
|
"newPassword",
|
|
"*.newPassword",
|
|
"currentPassword",
|
|
"*.currentPassword",
|
|
"passwordHash",
|
|
"*.passwordHash",
|
|
"token",
|
|
"*.token",
|
|
"*.*.token",
|
|
"accessToken",
|
|
"*.accessToken",
|
|
"refreshToken",
|
|
"*.refreshToken",
|
|
"apiKey",
|
|
"*.apiKey",
|
|
"authorization",
|
|
"*.authorization",
|
|
"cookie",
|
|
"*.cookie",
|
|
"totp",
|
|
"*.totp",
|
|
"totpSecret",
|
|
"*.totpSecret",
|
|
"secret",
|
|
"*.secret",
|
|
"req.headers.authorization",
|
|
"req.headers.cookie",
|
|
'res.headers["set-cookie"]',
|
|
];
|
|
|
|
const redactConfig = { paths: REDACT_PATHS, censor: "[REDACTED]" };
|
|
|
|
export const logger = isProduction
|
|
? pino({
|
|
level: LOG_LEVEL,
|
|
base: { service: "nexus-api" },
|
|
redact: redactConfig,
|
|
})
|
|
: pino(
|
|
{
|
|
level: LOG_LEVEL,
|
|
base: { service: "nexus-api" },
|
|
redact: redactConfig,
|
|
formatters: {
|
|
level(label: string) {
|
|
return { level: label };
|
|
},
|
|
},
|
|
},
|
|
devDestination,
|
|
);
|
|
|
|
export type Logger = typeof logger;
|