Skip to content

use "finsh" event to write msg on response time #552

Closed
wants to merge 2 commits into from
View
7 lib/middleware/logger.js
@@ -143,14 +143,11 @@ exports = module.exports = function logger(options) {
stream.write(line + '\n', 'ascii');
// proxy end to output logging
} else {
- var end = res.end;
- res.end = function(chunk, encoding){
- res.end = end;
- res.end(chunk, encoding);
+ res.on('finish', function(chunk, encoding) {
@dylanahsmith
dylanahsmith added a note Mar 11, 2013

The finish event isn't emitted with any parameters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
var line = fmt(exports, req, res);
if (null == line) return;
stream.write(line + '\n', 'ascii');
- };
+ });
}
Something went wrong with that request. Please try again.