Skip to content

Commit

Permalink
chore: add redaction for api_keys in logs
Browse files Browse the repository at this point in the history
  • Loading branch information
ADRFranklin committed Mar 30, 2024
1 parent db6213c commit 9cbf2a6
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pkg/api/src/loaders/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const logsFolder = path.join(pathsConfig.dataDir, './logs');

function createLogger(level: string): PinoLogger {
return pino({
level: level
level: level,
redact: ['api_key'],
}, pino.multistream([
{
level: level,
Expand Down Expand Up @@ -44,19 +45,19 @@ const loggerObj = {
}
logger = createLogger(level);
},
info: (message: string, obj = undefined) => {
info: (message: string, obj = {}) => {
logger.info(obj, message);
},
warn: (message: string, obj = undefined) => {
warn: (message: string, obj = {}) => {
logger.warn(obj, message);
},
error: (message: string, obj = undefined) => {
error: (message: string, obj = {}) => {
logger.error(obj, message);
},
debug: (message: string, obj = undefined) => {
debug: (message: string, obj = {}) => {
logger.debug(obj, message);
},
log: (level: string, message: string, obj = undefined) => {
log: (level: string, message: string, obj = {}) => {
logger[level](obj, message);
},
core: logger,
Expand Down

0 comments on commit 9cbf2a6

Please sign in to comment.