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

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -