egg-qr-log
v1.0.3
Published
```js // app.js async didReady() { this.app.httpclient.on('request', (req) => { // 可以在这里设置一些 trace headers,方便全链路跟踪 req.args.headers = transHeader(req.ctx, req.args.headers || {}) }) } ```
Downloads
3
Readme
header/tracid透传
// app.js
async didReady() {
this.app.httpclient.on('request', (req) => {
// 可以在这里设置一些 trace headers,方便全链路跟踪
req.args.headers = transHeader(req.ctx, req.args.headers || {})
})
}
日志
// extend/context.js
const {getLog, logId} = require('pazl-log');
let options = {
appName: 'node-katyusha-frontend-manage', // app名称
service: 'node-katyusha-frontend-manage', // 服务名
loggerName: 'egg-logger', // 日志名称
appTeam:'front-end', // 团队名称
appProject: 'node-katyusha-frontend-manage' // 项目名称
};
module.exports = {
get qrLog() {
return getLog(this, options);
},
...logId
}
// use
this.ctx.qrLog.info({"res-rows": res});