Can't get morgan logger to only print failed requests

I'm trying to get morgan logger to only print failed requests. The docs (https://www.npmjs.org/package/morgan) say to do this:

// EXAMPLE: only log error responses
morgan('combined', {
    skip: function (req, res) { return res.statusCode < 400 }
})

So here's my code:

var express = require('express');
var morgan = require('morgan');

var app = express();

app.use(morgan('combined', {
    skip: function(req, res) { return res.statusCode < 400 }
}));

However, every request just prints out "combined", and nothing else. Am I misunderstanding their example? I don't really see what else I should be doing.

I just saw the same problem.

It looks like the example is out of date. Instead of 'combined' try 'default'. You can see other valid options in the index.js file in the node_modules/morgan/index.js.