From e46ceec991edfe054583492746338dd70bfd77ad Mon Sep 17 00:00:00 2001 From: Saxon Nelson-Milton Date: Sun, 17 Sep 2023 11:01:22 +0000 Subject: [PATCH] Add more logging to createOrUpdate function It'd be useful to see more of what's going on in here. --- cmd/vidforward/main.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/vidforward/main.go b/cmd/vidforward/main.go index d2b138fb..b474c155 100644 --- a/cmd/vidforward/main.go +++ b/cmd/vidforward/main.go @@ -399,6 +399,7 @@ func (m *broadcastManager) isActive(ma MAC) bool { // status field of the broadcast i.e. whether we expect data from a source // or write the slate image. func (m *broadcastManager) createOrUpdate(broadcast Broadcast) error { + m.log.Debug("create or update","mac",broadcast.mac) m.mu.Lock() defer m.mu.Unlock() @@ -407,6 +408,7 @@ func (m *broadcastManager) createOrUpdate(broadcast Broadcast) error { // If there's no old broadcast, we need to create a new revid pipeline. if !ok { + m.log.Debug("no old broadcast, creating new pipeline","mac",broadcast.mac) var err error broadcast.rv, err = newRevid(m.log, broadcast.urls) if err != nil { @@ -418,6 +420,7 @@ func (m *broadcastManager) createOrUpdate(broadcast Broadcast) error { // If the URLS have changed, we need to update the revid pipeline. // We won't enter this if we've just created a new revid pipeline. if !reflect.DeepEqual(maybeOld.urls, broadcast.urls) { + m.log.Debug("RTMP URLs have changed, updating pipeline config","mac",broadcast.mac,"old",maybeOld.urls,"new",broadcast.urls) urls := strings.Join(broadcast.urls, ",") err := maybeOld.rv.Update(map[string]string{"RTMPURL": urls}) if err != nil { @@ -429,6 +432,7 @@ func (m *broadcastManager) createOrUpdate(broadcast Broadcast) error { // i.e. if the status is slate, we need to start writing the slate image. // We won't enter this if we've just created a new revid pipeline. if maybeOld.status != broadcast.status { + m.log.Debug("status has changed, starting or stopping slate","mac",broadcast.mac,"old",maybeOld.status,"new",broadcast.status) switch broadcast.status { case statusActive, statusPlay, statusCreate: m.log.Info("updating configuration for mac", "mac", broadcast.mac)