4 const assert
= require('assert');
5 const Logger
= require('../../src/logger');
6 const Config
= require('../../config');
8 describe('Logger', function () {
12 beforeEach(function () {
13 config
= new Config('test');
16 it('logs', function () {
17 logger
= new Logger(config
);
18 logger
.info('testScope', 'message', { baz: 'quux' }, { foo: 1 }, 'more other');
21 it('stubs missing levels', function () {
23 logger
= new Logger(config
, backend
);
24 assert
.strictEqual(typeof logger
.info
, 'function');
27 it('logs BigInts', function () {
28 logger
= new Logger(config
);
29 logger
.info('testScope', 'message', { aBigInteger: BigInt(2) });
32 it('logs Errors', function () {
33 logger
= new Logger(config
);
34 logger
.error('testScope', 'message', { e: new Error('an error') });
37 it('covers config error', function () {
38 config
.logger
.ignoreBelowLevel
= 'not a level';
40 logger
= new Logger(config
);
41 assert
.fail('expected RangeError here');
43 assert(e
instanceof RangeError
);
47 it('covers empty fields', function () {
48 logger
= new Logger(config
);
52 it('masks credentials', function () {
53 logger
= new Logger(config
);
54 logger
.info('testScope', 'message', {
58 credential: 'password',