From c657006530fb84d26ed89218bcf90953869c75e4 Mon Sep 17 00:00:00 2001 From: Denis Bilenko Date: Fri, 24 Jan 2025 12:45:09 +0100 Subject: [PATCH] Remove redundant logging after every mutator --- bundle/mutator.go | 12 +----------- bundle/mutator_read_only.go | 7 +------ 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/bundle/mutator.go b/bundle/mutator.go index 6c9968aac..462d53d3f 100644 --- a/bundle/mutator.go +++ b/bundle/mutator.go @@ -35,17 +35,7 @@ func Apply(ctx context.Context, b *Bundle, m Mutator) diag.Diagnostics { } }() - diags := m.Apply(ctx, b) - - // Log error in diagnostics if any. - // Note: errors should be logged when constructing them - // such that they are not logged multiple times. - // If this is done, we can omit this block. - if err := diags.Error(); err != nil { - log.Errorf(ctx, "Error: %s", err) - } - - return diags + return m.Apply(ctx, b) } type funcMutator struct { diff --git a/bundle/mutator_read_only.go b/bundle/mutator_read_only.go index ee4e36e0f..777198f13 100644 --- a/bundle/mutator_read_only.go +++ b/bundle/mutator_read_only.go @@ -20,10 +20,5 @@ func ApplyReadOnly(ctx context.Context, rb ReadOnlyBundle, m ReadOnlyMutator) di ctx = log.NewContext(ctx, log.GetLogger(ctx).With("mutator (read-only)", m.Name())) log.Debugf(ctx, "ApplyReadOnly") - diags := m.Apply(ctx, rb) - if err := diags.Error(); err != nil { - log.Errorf(ctx, "Error: %s", err) - } - - return diags + return m.Apply(ctx, rb) }