Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it("reads matcher and depth from heimdall's logging config if present", function() {
let logConfig = heimdall.configFor('logging');
logConfig.depth = 1;
logConfig.matcher = (id) => id.name == 'hello';
let prefixer = new Prefixer();
heimdall.start({ name: 'hello' });
heimdall.start({ name: 'somemthing-else' });
heimdall.start({ name: 'hello' });
expect(prefixer.prefix()).to.match(/\[hello#\d\] /);
});
function configureLogger(env) {
let depth = Number(env['DEBUG_DEPTH']);
if (depth) {
let logConfig = require('heimdalljs').configFor('logging');
logConfig.depth = depth;
}
}
constructor() {
let logConfig = heimdall.configFor('logging');
this.matcher = logConfig.matcher || MATCHER;
this.depth = typeof logConfig.depth === 'number' ? logConfig.depth : 3;
}