Skip to content

Commit

Permalink
Add option to trim *morgan* (#1925)
Browse files Browse the repository at this point in the history
Post #944

Auto-merge
  • Loading branch information
Martii authored Jan 6, 2022
1 parent 2dd6f8b commit dabd5b3
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,15 @@ server.listen(app.get('port'));
if (isDev || isDbg) {
app.use(morgan('dev'));
} else if (process.env.FORCE_MORGAN_PREDEF_FORMAT) {
app.use(morgan(process.env.FORCE_MORGAN_PREDEF_FORMAT));
app.use(morgan(process.env.FORCE_MORGAN_PREDEF_FORMAT, {
skip: function (aReq, aRes) {
if (process.env.FORCE_MORGAN_PREDEF_FORMAT_SKIP === 'true') {
return (aRes.statusCode >= 400 && aRes.statusCode <= 499 || aRes.statusCode === 304);
} else {
return false;
}
}
}));
}

app.use(bodyParser.urlencoded({
Expand Down

0 comments on commit dabd5b3

Please sign in to comment.