Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does the standard ruby logger have an "ignore" input?

I'm trying to write a spec test with no info to stdout - not even STDERR.

Is it easily possible to instantiate a Logger with an IOObject that throws away the data passed to it in all circumstances, without monkeypatching the logger?

If so, is this common practice or should I simply use STDERR?

Regards,

like image 603
Blake Avatar asked Aug 18 '14 10:08

Blake


1 Answers

You could create a logger for the null device:

logger = Logger.new(IO::NULL)

or set a high logging severity threshold:

logger.level = Logger::ERROR
like image 171
Stefan Avatar answered Sep 23 '22 00:09

Stefan