Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test('passes writes to stream on to a flaschenpost.', async (): Promise => {
const stop = record(false);
const morganPlugin = new MorganPlugin('info');
morganPlugin.write('some log message');
const { stdout } = stop();
const lines = stripAnsi(stdout).split('\n');
assert.that(lines[0]).is.equalTo('some log message (info)');
});
});
test('logs in a human readable format up to info level.', async (): Promise => {
const stop = record(false);
const logger = flaschenpostInstance.getLogger();
logger.info('Info message');
logger.debug('Debug message');
const { stdout } = stop();
const lines = stripAnsi(stdout).split('\n');
assert.that(lines).is.containing('Info message (info)');
assert.that(lines).is.not.containing('Debug message (debug)');
});
});
test('debug filtering by module.', async (): Promise => {
const originalConfiguration = flaschenpost.getConfiguration();
const stop = record(false);
flaschenpost.configure(
originalConfiguration.
withApplication({
name: 'some-module',
version: 'irrelevant'
}).
withDebugModuleFilter([ 'not-some-module' ]).
withHighestEnabledLogLevel('debug')
);
const logger = flaschenpost.getLogger();
logger.debug('Some debug.');
const { stdout } = stop();