Skip to content

Commit

Permalink
Small style tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
mjackson committed Dec 22, 2012
1 parent 4b13827 commit fad45fb
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/common-logger.js
Expand Up @@ -17,22 +17,23 @@ module.exports = function (app, stream) {
var req = new Request(env);

var addr = req.remoteAddr || '-';
var id = '-';
var id = '-'; // RFC 1413 identity of the client determined by identd on the client's machine
var user = env.remoteUser || '-';
var timestamp = '[' + strftime('%d/%b/%Y:%H:%M:%S %z', env.requestTime) + ']';
var protoVersion = 'HTTP/' + env.protocolVersion;
var reqline = '"' + req.method + ' ' + req.fullPath + ' ' + protoVersion + '"';
var length = '-';
var info = '"' + req.method + ' ' + req.fullPath + ' HTTP/' + env.protocolVersion + '"';

var length;
if ('Content-Length' in headers) {
length = headers['Content-Length'];
} else if (typeof body === 'string') {
length = Buffer.byteLength(body);
} else if (typeof body.length === 'number') {
length = String(body.length);
length = body.length;
} else {
length = '-';
}

var entry = [addr, id, user, timestamp, reqline, status, length].join(' ');
var entry = [addr, id, user, timestamp, info, status, length].join(' ');
stream.write(entry + '\n');

callback(status, headers, body);
Expand Down

0 comments on commit fad45fb

Please sign in to comment.