Tried to use a logger in a particular package.
The problem is that when I test the package I get a lot of logs (which I do not need at all).
Is there a way to disable logging completely in tests? I tried doing something like logrus.SetLevel(logrus.PanicLevel) in TestMain, but this only ignores tests below panic level. There is nothing that I have found above the panic level.
logger := logrus.New()
logger.Out = ioutil.Discard
For future visitors to this page, like me, I had to to the follow instead:
log.SetOutput(ioutil.Discard)
AKA:
logrus.SetOutput(ioutil.Discard)
@laverboy you should update your great answer with go after the opening triple-backtick like this:
```go
logrus.SetOutput(ioutil.Discard)
```
@sirupsen any way we could add this to the readme?
Or, we could add a feature where first thing in a log call, if the logger is disabled, the call is instantly dropped (for speed).
Most helpful comment
For future visitors to this page, like me, I had to to the follow instead: