Raphael Khaykin
Raphael Khaykin

Reputation: 23

Disable logs from 3rd party libraries in Go

I want to disable logs from various 3rd party libraries which a custom log package. I'm not able to modify the libraries directly or the log package. I've already looked at Disable logging for 3rd party library which suggests to redefine os.Stderr as a custom io.Writer. How do I implement the approach described here: https://stackoverflow.com/a/38832115/18024985?

Upvotes: 1

Views: 656

Answers (1)

Suzu Hirose
Suzu Hirose

Reputation: 312

The question you have pointed to describes a different situation from yours, where a custom logger is being used. In your case, with the standard logger, you should use log.SetOutput rather than redirecting os.Stderr.

Upvotes: 2

Related Questions