Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2021-11-16 11:47:51 +01:00
parent 26b5da1c1a
commit f9daf056e5
@@ -48,6 +48,19 @@ describe('rootLogger', () => {
);
});
it('redacts but ignores empty secrets', () => {
const logger = createRootLogger();
jest.spyOn(logger, 'write');
setRootLoggerRedactionList(['SECRET-1', 'SECRET_2', '']);
logger.info('Logging SECRET-1 and SECRET_2');
expect(logger.write).toHaveBeenCalledWith(
expect.objectContaining({
message: 'Logging [REDACTED] and [REDACTED]',
}),
);
});
describe('createRootLogger', () => {
it('creates a new logger', () => {
const oldLogger = getRootLogger();