Customize logging and add distinction for dev/prod
parent
f6037a1913
commit
be12e756a0
|
@ -48,19 +48,24 @@ app.use(favicon(path.join(__dirname + '/..', 'public', 'favicon.ico')));
|
|||
app.use(express.static(path.join(__dirname + '/..', 'public')));
|
||||
app.use(bodyParser.json());
|
||||
|
||||
// logging
|
||||
if (process.env.NODE_ENV !== config.test.env) {
|
||||
app.use(requestLogger('dev'));
|
||||
}
|
||||
|
||||
// API request checks for API-version and JSON etc.
|
||||
app.use(restAPIchecks);
|
||||
|
||||
|
||||
// Routes ******************************************************
|
||||
app.use(urls.auth, authenticateRouter);
|
||||
app.use(urls.signatures, signatureRouter);
|
||||
|
||||
// initialize logging here to exclude /signature requests
|
||||
if (!process.env.NODE_ENV) {
|
||||
// development logging
|
||||
app.use(requestLogger('dev'));
|
||||
} else if (process.env.NODE_ENV !== config.test.env) {
|
||||
// production logging, apache style
|
||||
app.use(requestLogger(':date :remote-addr :method :url :status :response-time ms'));
|
||||
}
|
||||
|
||||
app.use(urls.auth, authenticateRouter);
|
||||
app.use(urls.overview, overviewRouter);
|
||||
app.use(urls.users, userRouter);
|
||||
app.use(urls.squads, squadRouter);
|
||||
|
|
Loading…
Reference in New Issue