Initial LisgloSIPS V2 implementation
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import pino, { type Logger, type LoggerOptions } from 'pino';
|
||||
|
||||
export const LOG_REDACT_PATHS = [
|
||||
'req.headers.authorization',
|
||||
'req.headers.cookie',
|
||||
'res.headers["set-cookie"]',
|
||||
'*.password',
|
||||
'*.sipPassword',
|
||||
'*.sipHa1',
|
||||
'*.token',
|
||||
'*.refreshToken'
|
||||
];
|
||||
|
||||
export function createLogger(service: string, level = 'info'): Logger {
|
||||
const options: LoggerOptions = {
|
||||
name: service,
|
||||
level,
|
||||
redact: {
|
||||
paths: LOG_REDACT_PATHS,
|
||||
censor: '[REDACTED]'
|
||||
},
|
||||
base: {
|
||||
service
|
||||
},
|
||||
timestamp: pino.stdTimeFunctions.isoTime
|
||||
};
|
||||
|
||||
return pino(options);
|
||||
}
|
||||
Reference in New Issue
Block a user