UNPKG

signalfx-tracing

Version:

Provides auto-instrumentation for JavaScript libraries and frameworks

26 lines (21 loc) 558 B
'use strict' const tx = require('./util/log') function createWrapEmit (tracer, config) { return function wrapEmit (emit) { return function emitWithTrace (rec, noemit) { arguments[0] = tx.correlate(tracer, rec) return emit.apply(this, arguments) } } } module.exports = { name: 'bunyan', versions: ['>=1'], patch (Logger, tracer, config) { if (!tracer._logInjection) return this.wrap(Logger.prototype, '_emit', createWrapEmit(tracer, config)) }, unpatch (Logger) { this.unwrap(Logger.prototype, '_emit') } }