Browse Source

Logger: print to io.Discard when the logger output is set to nil

master
parent
commit
0b23790caa
  1. 3
      logger.go

3
logger.go

@ -36,6 +36,9 @@ func init() {
// Set up loggers to write to the given writer // Set up loggers to write to the given writer
func SetOutput(writer io.Writer) { func SetOutput(writer io.Writer) {
if writer == nil {
writer = io.Discard
}
infoLog.SetOutput(writer) infoLog.SetOutput(writer)
warningLog.SetOutput(writer) warningLog.SetOutput(writer)
errorLog.SetOutput(writer) errorLog.SetOutput(writer)

Loading…
Cancel
Save