From 0998e8a35155dc34cb3e3dc0c42fb22793afed56 Mon Sep 17 00:00:00 2001 From: Evan Anderson Date: Sat, 26 Oct 2024 16:26:38 -0700 Subject: [PATCH] Reduce the amount of configuration logging, and make it line-delimeted friendly (#4505) * Reduce the amount and style of configuration logging Signed-off-by: Evan Anderson * Update verbosity from 1->4 Signed-off-by: Evan Anderson Signed-off-by: Evan Anderson --------- Signed-off-by: Evan Anderson Signed-off-by: Evan Anderson (cherry picked from commit 7897fc50274dc89540a232118aa23077e73092d6) Signed-off-by: Huabing Zhao --- internal/gatewayapi/runner/runner.go | 8 ++++++-- internal/ir/infra.go | 2 +- internal/ir/xds.go | 2 +- release-notes/current.yaml | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/internal/gatewayapi/runner/runner.go b/internal/gatewayapi/runner/runner.go index bd093761911..55023c41a8d 100644 --- a/internal/gatewayapi/runner/runner.go +++ b/internal/gatewayapi/runner/runner.go @@ -173,7 +173,9 @@ func (r *Runner) subscribeAndTranslate(ctx context.Context) { // Publish the IRs. // Also validate the ir before sending it. for key, val := range result.InfraIR { - r.Logger.WithValues("infra-ir", key).Info(val.JSONString()) + if vlog := r.Logger.V(4); vlog.Enabled() { + vlog.WithValues("infra-ir", key).Info(val.JSONString()) + } if err := val.Validate(); err != nil { r.Logger.Error(err, "unable to validate infra ir, skipped sending it") errChan <- err @@ -184,7 +186,9 @@ func (r *Runner) subscribeAndTranslate(ctx context.Context) { } for key, val := range result.XdsIR { - r.Logger.WithValues("xds-ir", key).Info(val.JSONString()) + if vlog := r.Logger.V(4); vlog.Enabled() { + vlog.WithValues("xds-ir", key).Info(val.JSONString()) + } if err := val.Validate(); err != nil { r.Logger.Error(err, "unable to validate xds ir, skipped sending it") errChan <- err diff --git a/internal/ir/infra.go b/internal/ir/infra.go index 8bf433785fb..7044b695fda 100644 --- a/internal/ir/infra.go +++ b/internal/ir/infra.go @@ -36,7 +36,7 @@ func (i *Infra) YAMLString() string { } func (i *Infra) JSONString() string { - j, _ := json.MarshalIndent(i, "", "\t") + j, _ := json.Marshal(i) return string(j) } diff --git a/internal/ir/xds.go b/internal/ir/xds.go index 10c418af462..5e26af0f479 100644 --- a/internal/ir/xds.go +++ b/internal/ir/xds.go @@ -181,7 +181,7 @@ func (x *Xds) YAMLString() string { } func (x *Xds) JSONString() string { - j, _ := json.MarshalIndent(x.Printable(), "", "\t") + j, _ := json.Marshal(x.Printable()) return string(j) } diff --git a/release-notes/current.yaml b/release-notes/current.yaml index bfc711148bd..8240c9ab163 100644 --- a/release-notes/current.yaml +++ b/release-notes/current.yaml @@ -14,7 +14,7 @@ new features: | # Fixes for bugs identified in previous versions. bug fixes: | - Add a bug fix here + Only log endpoint configuration in verbose logging mode (`-v 4` or higher) # Enhancements that improve performance. performance improvements: |