Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
making the log format configurable and enabled morgan logging on all …
Browse files Browse the repository at this point in the history
…environments, not just development
  • Loading branch information
lirantal committed Nov 6, 2014
1 parent 42931d3 commit 0f4a585
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions config/env/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ module.exports = {
templateEngine: 'swig',
sessionSecret: 'MEAN',
sessionCollection: 'sessions',
log: {
// Can specify one of 'combined', 'common', 'dev', 'short', 'tiny'
format: 'combined'
},
assets: {
lib: {
css: [
Expand Down
4 changes: 4 additions & 0 deletions config/env/development.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

module.exports = {
db: 'mongodb://localhost/mean-dev',
log: {
// Can specify one of 'combined', 'common', 'dev', 'short', 'tiny'
format: 'dev'
},
app: {
title: 'MEAN.JS - Development Environment'
},
Expand Down
6 changes: 3 additions & 3 deletions config/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ module.exports = function(db) {
app.set('view engine', 'server.view.html');
app.set('views', './app/views');

// Enable logger (morgan)
app.use(morgan(config.log.format));

// Environment dependent middleware
if (process.env.NODE_ENV === 'development') {
// Enable logger (morgan)
app.use(morgan('dev'));

// Disable views cache
app.set('view cache', false);
} else if (process.env.NODE_ENV === 'production') {
Expand Down

0 comments on commit 0f4a585

Please sign in to comment.