Skip to content

Commit

Permalink
Fix backwards compatibility in logger
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Aug 12, 2014
1 parent 46be102 commit a50c28c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
5 changes: 5 additions & 0 deletions History.md
@@ -1,3 +1,8 @@
2.x
===

* Fix backwards compatibility in `logger`

2.25.4 / 2014-08-10
===================

Expand Down
2 changes: 2 additions & 0 deletions lib/middleware/logger.js
Expand Up @@ -41,3 +41,5 @@ module.exports = function logger(options) {

return morgan(opts.format, opts);
};

utils.merge(module.exports, morgan);
16 changes: 16 additions & 0 deletions test/logger.js
Expand Up @@ -24,4 +24,20 @@ describe('connect.logger()', function () {
});
})
})

describe('with custom token', function () {
it('should output the custom token', function (done) {
var app = connect();
connect.logger.token('custom', function (req) { return req.headers['x-custom-value']; });
app.use(connect.logger({'format': ':custom', 'stream': {'write': saveLastLogLine}}));

app.request()
.get('/')
.set('x-custom-value', 'so_custom')
.end(function (res) {
lastLogLine.should.equal('so_custom\n');
done();
});
})
})
});

0 comments on commit a50c28c

Please sign in to comment.