clux / logule

A multi-transport, peer-dependent logging library for nodejs - UNMAINTAINED
MIT License
35 stars 5 forks source link

Different configs by env #19

Closed Philmod closed 10 years ago

Philmod commented 10 years ago

Hey man,

I want to suppress info logs when I run my tests, is there an easy way to have separate .logule.json or even turn them off in my code?

Thanks, Philmod

clux commented 10 years ago

mute() should work for this.

// myModule/tests/test.js
var log = require('logule').init(module, 'tests').mute('info');
var myModule = require('../');
Philmod commented 10 years ago

I'm using require('logule').init(module, '...') for my modules in my code, but I want to suppress these logs when I run my tests (npm test).

Does it make sense?

clux commented 10 years ago

Yeah, you just got to require logule in the main file that npm test runs. That will mute everything below, that being the module you are testing.

Philmod commented 10 years ago

Cool, thanks.

On 28 April 2014 16:31, Eirik Albrigtsen notifications@github.com wrote:

Yeah, you just got to require logule in the main file that npm test runs. That will mute everything below, that being the module you are testing.

— Reply to this email directly or view it on GitHubhttps://github.com/clux/logule/issues/19#issuecomment-41626976 .

Philippe Modard 415-722-1245 philippe.modard@gmail.com philippe.modard@modygo.com twitter.com/philmod re.vu/philippemodard www.linkedin.com/in/philippemodard IBAN BE70 0639 3284 8025 - BIC: GKCCBEBB