From b9e093cd6b0cc620d991e812cfdca9b3c4524ba8 Mon Sep 17 00:00:00 2001 From: James Shubin Date: Wed, 18 Sep 2024 21:47:29 -0400 Subject: [PATCH] engine: resources: svc: Reduce unnecessary logging --- engine/resources/svc.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/engine/resources/svc.go b/engine/resources/svc.go index 2c07899e..c0be5c50 100644 --- a/engine/resources/svc.go +++ b/engine/resources/svc.go @@ -220,7 +220,9 @@ func (obj *SvcRes) Watch(ctx context.Context) error { } if invalid { - obj.init.Logf("waiting for service") // waiting for svc to appear... + if obj.init.Debug { + obj.init.Logf("waiting for service") // waiting for svc to appear... + } if activeSet { activeSet = false set.Remove(svc) // no return value should ever occur @@ -240,11 +242,13 @@ func (obj *SvcRes) Watch(ctx context.Context) error { set.Add(svc) // no return value should ever occur } - obj.init.Logf("watching...") // attempting to watch... + //obj.init.Logf("watching...") // attempting to watch... select { case event := <-subChannel: - obj.init.Logf("event: %+v", event) + if obj.init.Debug { + obj.init.Logf("event: %+v", event) + } // NOTE: the value returned is a map for some reason... if event[svc] != nil { // event[svc].ActiveState is not nil @@ -352,7 +356,6 @@ func (obj *SvcRes) CheckApply(ctx context.Context, apply bool) (bool, error) { } // apply portion - obj.init.Logf("Apply") files := []string{svc} // the svc represented in a list if obj.Startup == "enabled" { _, _, err = conn.EnableUnitFilesContext(ctx, files, false, true)