@contrast/route-metrics
Version:
`route-metrics` allows server performance, exclusive of network time, to be compared on a route-by-route basis. It was created to compare server performance with and without `@contrast/agent` being loaded and active.
14 lines (12 loc) • 505 B
JavaScript
;
module.exports = function patcherSetup(patchListener, loadListener) {
// the require patcher gets setup for both types: esm and cjs
const {patcher, emitter: patchEmitter} = require('./patcher');
// the presence of the loadListener is used as a flag so that 'load' events
// won't be emitted when they are not enabled.
patcher.enable({logAllLoads: !!loadListener});
patchEmitter.on('patch', patchListener);
if (loadListener) {
patchEmitter.on('load', loadListener);
}
};