From 2106b1e52d04e89fa053bd731931789ad650e643 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 27 Mar 2016 01:11:59 +0100 Subject: streamlined log output diff --git a/src/rhctl/audio_switch.go b/src/rhctl/audio_switch.go index dc1955e..4f1ef31 100644 --- a/src/rhctl/audio_switch.go +++ b/src/rhctl/audio_switch.go @@ -69,11 +69,11 @@ type AudioSwitch struct { func (sw *AudioSwitch) handleData(data string) { if len(data) < 3 { - rhl.Printf("Warning: ignoring short line from audioswitch") + rhl.Printf("Audioswitch: ignoring short line") return } - rhdl.Printf("got data from audio switch: %q", data) + rhdl.Printf("Audioswitch: got data: %q", data) switch data[0:3] { case "RRR": fallthrough @@ -89,7 +89,7 @@ func (sw *AudioSwitch) handleData(data string) { sw.timer.Stop() sw.timer = nil } else { - rhl.Printf("Warning: ignoring unexpected response: %q", data) + rhl.Printf("Audioswitch: ignoring unexpected response: %q", data) } case "S0L": sw.Updates <- SwitchUpdate{SwitchStatus, data} @@ -102,7 +102,7 @@ func (sw *AudioSwitch) handleData(data string) { case "S0S": sw.Updates <- SwitchUpdate{SwitchSilence, data} default: - rhl.Printf("Warning: ignoring invalid data from switch: %q", data) + rhl.Printf("Audioswitch: ignoring invalid data: %q", data) } } @@ -112,7 +112,7 @@ func (sw *AudioSwitch) Run() { sw.current = nil sw.timer = nil - rhdl.Printf("audioswitch handler running...") + rhdl.Printf("Audioswitch: handler running...") for { if sw.current != nil { select { @@ -151,7 +151,7 @@ func SwitchInit(conf *Config) (sw *AudioSwitch, err error) { sw.Updates = make(chan SwitchUpdate, 32) if sw.port, err = SerialOpen(conf.Audioswitch.Device, conf.Audioswitch.Baudrate, ""); err != nil { - err = fmt.Errorf("Error opening switch port: %s", err) + err = fmt.Errorf("Audioswitch: error opening serial port: %s", err) return } return diff --git a/src/rhctl/main.go b/src/rhctl/main.go index 4638293..23a7f13 100644 --- a/src/rhctl/main.go +++ b/src/rhctl/main.go @@ -116,11 +116,6 @@ func main() { }(server) } - // TODO: remove this after testing server interface - for { - rhl.Printf("new server state: %+v", <-servers[0].Updates) - } - <-stop rhl.Printf("at least one essential part has stopped - bringing down the whole process") } diff --git a/src/rhctl/playout_server.go b/src/rhctl/playout_server.go index ea99268..7d4b822 100644 --- a/src/rhctl/playout_server.go +++ b/src/rhctl/playout_server.go @@ -73,7 +73,7 @@ func (srv *PlayoutServer) handleControl(data string) { srv.Updates <- srv.status return } - rhl.Printf("Warning: ignoring unknown control message from '%s': %q", srv.name, data) + rhl.Printf("Server(%s): ignoring unknown control message: %q", srv.name, data) } func (srv *PlayoutServer) handleHeartbeat(data string) { @@ -105,7 +105,7 @@ func (srv *PlayoutServer) Run() { srv.hbtimer = time.NewTimer(srv.hbtimeout) srv.hbcnt = 0 - rhdl.Printf("Server(%s) handler running...", srv.name) + rhdl.Printf("Server(%s): handler running...", srv.name) for { select { case <-stop: @@ -136,11 +136,11 @@ func ServerInit(name string, conf *Config) (srv *PlayoutServer, err error) { srv.Updates = make(chan ServerStatus, 8) if srv.control, err = SerialOpen(conf.Servers[name].ControlDevice, conf.Servers[name].ControlBaudrate, "\r\n"); err != nil { - err = fmt.Errorf("Error opening control port(%s): %s", srv.name, err) + err = fmt.Errorf("Server(%s): error opening control port: %s", srv.name, err) return } if srv.heartbeat, err = SerialOpen(conf.Servers[name].HeartbeatDevice, conf.Servers[name].HeartbeatBaudrate, "\r\n"); err != nil { - err = fmt.Errorf("Error opening control port(%s): %s", srv.name, err) + err = fmt.Errorf("Server(%s): error opening heartbeat port: %s", srv.name, err) return } -- cgit v0.10.2