// Copyright 2011 Joyent, Inc.  All rights reserved.

function pad(val) {
  if (parseInt(val, 10) < 10) {
    val = '0' + val;
  }
  return val;
}

function logRequest(request, response, next) {
  // Logs in the W3C Common Log Format
  var d = new Date();
  console.log((request.connection.remoteAddress || request._zone) +
              ' - - [' +
              pad(d.getUTCDate()) + '/' +
              pad(d.getUTCMonth()) + '/' +
              d.getUTCFullYear() + ':' +
              pad(d.getUTCHours()) + ':' +
              pad(d.getUTCMinutes()) + ':' +
              pad(d.getUTCSeconds()) + ' GMT] "' +
              request.method + ' ' +
              request.url +
              ' HTTP/' + request.httpVersion + '" ' +
              response._code + ' ' +
              response._bytes + ' ' +
              response._time
             );
  return next();
}

module.exports = (function() { return logRequest; })();

@@ -1,10 +1,13 @@
 /
-/
+*%0A *
  Copyrig
@@ -49,16 +49,89 @@
 served.%0A
+ *%0A * Restify middleware to log a request in W3C Common Log format.%0A */%0A%0A
 %0Afunctio
@@ -221,93 +221,68 @@
 %0A%7D%0A%0A
-function logRequest(request, response, next) %7B%0A  // Logs in the W3C Common Log Format
+%0Amodule.exports = function w3clog(request, response, next) %7B
 %0A  v
@@ -921,60 +921,4 @@
 %0A%7D%0A%0A
-module.exports = (function() %7B return logRequest; %7D)();%0A

Refactor w3clog middleware module slightly.