Skip to content

Commit

Permalink
feat: remove tracer (#311)
Browse files Browse the repository at this point in the history
  • Loading branch information
popomore authored and fengmk2 committed Feb 3, 2017
1 parent 8d98e4f commit 0c38b9b
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 43 deletions.
10 changes: 0 additions & 10 deletions app/extend/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,6 @@ const proto = module.exports = {
return this[HELPER];
},

/**
* 默认返回一个空对象,需要实现这个接口
*
* 插件需要实现一个内部约定 getter: `_tracer`
* @member {Object} Context#tracer
*/
get tracer() {
return this._tracer || {};
},

/**
* Wrap app.loggers with context infomation,
* if a custom logger is defined by naming aLogger, then you can `ctx.getLogger('aLogger')`
Expand Down
5 changes: 1 addition & 4 deletions test/app/extend/context.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ describe('test/app/extend/context.test.js', () => {

app.mockContext({
userId: '123123',
tracer: {
traceId: '456456',
},
});

yield request(app.callback())
Expand All @@ -68,7 +65,7 @@ describe('test/app/extend/context.test.js', () => {
const errorContent = fs.readFileSync(path.join(logdir, 'common-error.log'), 'utf8');
errorContent.should.containEql('nodejs.Error: error foo');
errorContent.should.containEql('nodejs.Error: core error foo');
errorContent.should.match(/\[123123\/[\d.]+\/456456\/\d+ms GET \/logger\?message=foo]/);
errorContent.should.match(/\[123123\/[\d.]+\/-\/\d+ms GET \/logger\?message=foo]/);

const loggerContent = fs.readFileSync(path.join(logdir, 'demo-web.log'), 'utf8');
loggerContent.should.not.containEql('debug foo');
Expand Down
26 changes: 0 additions & 26 deletions test/fixtures/apps/middlewares/app/controller/trace.js

This file was deleted.

3 changes: 0 additions & 3 deletions test/fixtures/apps/middlewares/app/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,5 @@

module.exports = app => {
app.get('/', app.controller.home);
app.get('/traceClient', app.controller.trace.traceClient);

app.get('/traceServer', app.controller.trace.traceServer);
app.get('/error', app.controller.error);
};

0 comments on commit 0c38b9b

Please sign in to comment.