Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eggjs/egg-tracer
tracer plugin for egg
https://github.com/eggjs/egg-tracer
egg-plugin
Last synced: about 1 month ago
JSON representation
tracer plugin for egg
- Host: GitHub
- URL: https://github.com/eggjs/egg-tracer
- Owner: eggjs
- License: mit
- Created: 2016-08-16T04:29:11.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-05-24T13:22:21.000Z (over 1 year ago)
- Last Synced: 2024-10-29T21:05:55.063Z (about 1 month ago)
- Topics: egg-plugin
- Language: JavaScript
- Homepage:
- Size: 21.5 KB
- Stars: 29
- Watchers: 11
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-egg - egg-tracer - tracer plugin for egg. ![](https://img.shields.io/github/stars/eggjs/egg-tracer.svg?style=social&label=Star) ![](https://img.shields.io/npm/dm/egg-tracer.svg?style=flat-square) (仓库 / 插件)
- awesome-egg - egg-tracer - tracer plugin for egg (Plugins)
README
# egg-tracer
[![NPM version][npm-image]][npm-url]
[![Test coverage][codecov-image]][codecov-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url][npm-image]: https://img.shields.io/npm/v/egg-tracer.svg?style=flat-square
[npm-url]: https://npmjs.org/package/egg-tracer
[codecov-image]: https://img.shields.io/codecov/c/github/eggjs/egg-tracer.svg?style=flat-square
[codecov-url]: https://codecov.io/github/eggjs/egg-tracer?branch=master
[snyk-image]: https://snyk.io/test/npm/egg-tracer/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/egg-tracer
[download-image]: https://img.shields.io/npm/dm/egg-tracelog.svg?style=flat-square
[download-url]: https://npmjs.org/package/egg-tracertracer plugin for egg.
## Install
```bash
npm i egg-tracer
```## Usage
Enable tracer plugin:
```js
// config/plugin.js
exports.tracer = {
enable: true,
package: 'egg-tracer',
};
```### Build my own tracer
```js
// my_tracer.js
const Tracer = require('egg-tracer');const counter = 0;
class MyTracer extends Tracer {
get traceId() {
return `${counter++}-${Date.now()}-${process.pid}`;
}
}
module.exports = MyTracer;
```Change the config to use `MyTracer`:
```js
// config/config.default.js
exports.tracer = {
Class: require('path/to/my_tracer.js'),
};
```## Questions & Suggestions
Please open an issue [here](https://github.com/eggjs/egg/issues).
## License
[MIT](LICENSE)