UNPKG

egg-tracer

Version:
21 lines (17 loc) 405 B
const cacheTracer = Symbol('before_ready_tracer'); const isReady = Symbol.for('egg_tracer_is_ready'); module.exports = { get tracer() { if (this[isReady]) { return new this.config.tracer.Class({ app: this, }); } if (!this[cacheTracer]) { this[cacheTracer] = new this.config.tracer.Class({ app: this, }); } return this[cacheTracer]; }, };