Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function pipe(next, context, action) {
const mypipeline = new Pipeline(action);
mypipeline.use(next);
return mypipeline.run(context);
}
/**
*
* @param {Function} cont the continuation function
* @returns {Function} the wrapped main function
*/
const pre = (cont) => cont;
const log = new SimpleInterface({
level: 'debug',
logger: new ConsoleLogger(),
});
// keep backward compatible with winston logger
log.log = (level, ...msg) => log._logImpl(level, ...msg, {});
const defaults = {
pipe,
pre,
log,
};
module.exports = defaults;
it('it logs even if no trace logging', async () => {
const winstonLogger = new SimpleInterface({
level: 'debug',
logger: new ConsoleLogger(),
});
winstonLogger.trace = undefined;
const params = {
__ow_headers: {
'content-type': 'application/json',
},
__ow_method: 'get',
__ow_logger: winstonLogger,
};
const ret = await runPipeline((context, action) => {
action.logger.trace({ myId: 42 }, 'Hello, world');
}, pipe, params);
assert.deepEqual(ret, {