node.js - Hapi good logging depends on the enviroment -
is there way enable / disable depends on enviroment in ?
for instance i'd run when node_env equal develepement
var goodoptions = { opsinterval: 1000, reporters: [{ reporter: require('good-console'), events: {log: '*', response: '*' , error: '*' , request: '*'} }] }; server.register({ register: require('good'), options: goodoptions }, function(err) { if (err) { throw err; } } );
no ternary operator :)
you add:
if (process.env.node_env !== 'development') { goodoptions.reporters = []; }
if start getting complex configuration should take @ hapijs/confidence powerful configuration tool. overkill though.
Comments
Post a Comment