paulodiovani paulodiovani - 5 months ago 21
Node.js Question

Disable Hapi logs on test environment

I'm using Hapi with Good on a small project and want to disable some logs while testing (

process.env.NODE_ENV == 'test'
).

This is my
Good
configuration:

reporters: {
console: [{
module: 'good-console',
}, 'stdout']
}


And this is the test output:

➜ npm test

Index Route
✓ is ok
160622/214344.247, [response] http://paulodiovani-ideapad:3001: get / {} 200 (27ms)


How can I disable all logs, except
error
?

Answer

Can you post your good configuration? you probably want something like:

reporters: {
    console: [
      {
        module: 'good-squeeze',
        name: 'Squeeze',
        args: [{error: '*'}]
      },
      {
        module: 'good-console'
      },
      'stderr']
  }
Comments