Enable silent mode with -s option to not log successful request (status=200)
This commit is contained in:
parent
e737753891
commit
45df72df51
2 changed files with 12 additions and 3 deletions
|
@ -46,6 +46,10 @@ var opts = require('commander')
|
|||
'-V, --verbose',
|
||||
'More verbose output'
|
||||
)
|
||||
.option(
|
||||
'-s, --silent',
|
||||
'Less verbose output'
|
||||
)
|
||||
.version(
|
||||
packageJson.version,
|
||||
'-v, --version'
|
||||
|
@ -60,7 +64,8 @@ var startServer = function(configPath, config) {
|
|||
config: config,
|
||||
bind: opts.bind,
|
||||
port: opts.port,
|
||||
cors: opts.cors
|
||||
cors: opts.cors,
|
||||
silent: opts.silent
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -43,9 +43,13 @@ function start(opts) {
|
|||
app.enable('trust proxy');
|
||||
|
||||
if (process.env.NODE_ENV == 'production') {
|
||||
app.use(morgan('tiny'));
|
||||
app.use(morgan('tiny', {
|
||||
skip: function(req, res) { return opts.silent && res.statusCode == 200 }
|
||||
}));
|
||||
} else if (process.env.NODE_ENV !== 'test') {
|
||||
app.use(morgan('dev'));
|
||||
app.use(morgan('dev', {
|
||||
skip: function(req, res) { return opts.silent && res.statusCode == 200 }
|
||||
}));
|
||||
}
|
||||
|
||||
var config = opts.config || null;
|
||||
|
|
Loading…
Reference in a new issue