egg-tracer

2018-11-10 admin

egg-tracer是什么

什么是egg-tracer,tracer for egg

egg-tracer使用教程帮助文档

egg-tracer

NPM version build status Test coverage David deps Known Vulnerabilities npm download

tracer for egg.

Install

$ npm i egg-tracer

Usage

Enable tracer plugin:

// config/plugin.js
exports.tracer = {
  enable: true,
  package: 'egg-tracer',
};

Build my own tracer

// my_tracer.js
const Tracer = require('egg-tracer');

const counter = 0;

class MyTracer extends Tracer {
  get tracerId() {
    return `${counter++}-${Date.now()}-${process.pid}`;
  }
}

Change the config to use MyTracer:

// config/config.default.js
exports.tracer = {
  Class: require('path/to/my_tracer.js'),
};

Questions & Suggestions

Please open an issue here.

License

MIT

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-45040.html

文章标题:egg-tracer

回到顶部