Q:

How can I conditionally suppress logging in Express (or Connect)?

When using the logger middleware which is part of Connect (as well as Express), I would like to be able to disable logging on certain requests, say by setting a flag on the response or something.
I managed to do it by saying:
res.doNotLog = true;

and then, deep in logger.js (part of the Connect module), I put
if(res.doNotLog) return;

in the right place.  But of course I don't want to be modifying code in the module itself.  Is there any way I can cause the same to happen without having to hack the module?
Edit:
This worked:
var app = _express.createServer();

// set 'hello' routing...note that this is before middleware 
// so it won't be logged
app.get('/sayhello', function(req, res) {res.send("hey");});

// configure middleware: logging, static file serving
app.configure(function() {
    app.use(_express.logger());
    app.use(_express.static(__dirname + '/www'));
  });

// set 'goodbye' routing...note that this is after middleware 
// so it will be logged
app.get('/saygoodbye', function(req, res) {res.send("later...");});

A:

The most obvious thing would be to put the handlers for those requests before the logger. This is easy in pure Connect, not sure how to do it in Express because a lot of the router code is shared between routes. If there were only a few such requests, you could handle them Connect-style earlier in the stack than app.router.

