Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
interface Logger {
info: LogFunction;
debug: LogFunction;
error: LogFunction;
}
const defaultLogger = (name: string): Logger => {
return {
info: (...args) => console.info(name, ...args), // tslint:disable-line:no-console
debug: (...args) => console.debug(name, ...args), // tslint:disable-line:no-console
error: (...args) => console.error(name, ...args), // tslint:disable-line:no-console
};
};
const getInfo = pick(['url', 'query', 'payload']);
/**
* Logs request events and timing
*
* requestParams:
* silent {boolean}
*
* metaInfo:
* log.start {number} - request start Date.now()
* log.end {number} - request end Date.now()
* log.duration {number} - request duration (end - start)
*
* @param name {string}
* @param logger {Function} - logger factory
* @return {{init: init, complete: complete, error: error}}
*/