diff --git a/overlord.go b/overlord.go index f7f08fe..92adb14 100644 --- a/overlord.go +++ b/overlord.go @@ -397,11 +397,11 @@ func iterate() { func main() { var syslogCfg = os.Getenv("SYSLOG_ADDRESS") if len(syslogCfg) > 0 { - logWriter, err := syslog.Dial("udp", syslogCfg, syslog.LOG_LOCAL0|syslog.LOG_ERR, "av-balancing") + syslogWriter, err := syslog.Dial("udp", syslogCfg, syslog.LOG_LOCAL0|syslog.LOG_ERR, "av-balancing") if err != nil { panic(err) } - log.SetOutput(doubleWriter{logWriter, os.Stdout}) + log.SetOutput(io.MultiWriter(os.Stdout, syslogWriter)) } for { @@ -410,20 +410,6 @@ func main() { } } -// write to two io.Writer -type doubleWriter struct { - a, b io.Writer -} - -func (dw doubleWriter) Write(p []byte) (int, error) { - n, err := dw.a.Write(p) - if err != nil { - return n, err - } - n, err = dw.b.Write(p) - return n, err -} - // func main() { // for { // log.Println(lookupIPs("qa-site-survey-instance"))