Skip to content

Commit

Permalink
Reduce the amount of configuration logging, and make it line-delimete…
Browse files Browse the repository at this point in the history
…d friendly (envoyproxy#4505)

* Reduce the amount and style of configuration logging

Signed-off-by: Evan Anderson <evan@stacklok.com>

* Update verbosity from 1->4

Signed-off-by: Evan Anderson <evan@stacklok.com>
Signed-off-by: Evan Anderson <evan.k.anderson@gmail.com>

---------

Signed-off-by: Evan Anderson <evan@stacklok.com>
Signed-off-by: Evan Anderson <evan.k.anderson@gmail.com>
(cherry picked from commit 7897fc5)
Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
  • Loading branch information
evankanderson authored and zhaohuabing committed Oct 29, 2024
1 parent 0bdc1ab commit 0998e8a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions internal/gatewayapi/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion internal/ir/infra.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion internal/ir/xds.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion release-notes/current.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down

0 comments on commit 0998e8a

Please sign in to comment.