mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
Reduce logging in production.
This commit is contained in:
parent
0552e588ae
commit
8b9c0a6e85
6
app.js
6
app.js
@ -33,7 +33,11 @@ app.use(validator([]));
|
||||
app.set('trust proxy');
|
||||
app.locals.baseUriPath = baseUriPath;
|
||||
|
||||
app.use(log4js.connectLogger(logger, {format: ':remote-addr :status :method :url :response-timems'}));
|
||||
app.use(log4js.connectLogger(logger, {
|
||||
format: ':remote-addr :status :method :url :response-timems',
|
||||
level: 'auto' // 3XX=WARN, 4xx/5xx=ERROR
|
||||
}));
|
||||
|
||||
app.set('port', process.env.HTTP_PORT || process.env.PORT || 4242);
|
||||
|
||||
app.use(baseUriPath, express.static(__dirname + '/public'));
|
||||
|
@ -3,4 +3,13 @@ var log4js = require('log4js');
|
||||
log4js.clearAppenders();
|
||||
log4js.addAppender(log4js.appenders.console());
|
||||
|
||||
module.exports = log4js.getLogger('unleash');
|
||||
var logger = log4js.getLogger('unleash');
|
||||
|
||||
// TODO: make level configurable
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
logger.setLevel(log4js.levels.ERROR);
|
||||
} else {
|
||||
logger.setLevel(log4js.levels.DEBUG);
|
||||
}
|
||||
|
||||
module.exports = logger;
|
Loading…
Reference in New Issue
Block a user