Phase 1-2 of server consolidation + security hardening
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import { pino } from 'pino';
|
||||
|
||||
const REDACTED_PATHS = [
|
||||
'req.headers.authorization',
|
||||
'req.headers.cookie',
|
||||
'headers.authorization',
|
||||
'headers.cookie',
|
||||
'*.password',
|
||||
'*.token',
|
||||
'*.jwt',
|
||||
];
|
||||
|
||||
export function createLogger(options = {}) {
|
||||
return pino({
|
||||
level: process.env.LOG_LEVEL ?? 'info',
|
||||
redact: {
|
||||
paths: REDACTED_PATHS,
|
||||
censor: '[REDACTED]',
|
||||
},
|
||||
base: {
|
||||
service: options.service ?? process.env.SERVICE_NAME ?? 'inventory',
|
||||
},
|
||||
...options,
|
||||
});
|
||||
}
|
||||
|
||||
export const logger = createLogger();
|
||||
Reference in New Issue
Block a user