From e6d3880d472b803f19accae754c9844ab247bc11 Mon Sep 17 00:00:00 2001 From: jmxnzo Date: Tue, 3 Dec 2024 12:20:50 +0100 Subject: [PATCH] cli/genpolicy: include log-level 'debug' in Contrast logs --- cli/genpolicy/genpolicy.go | 2 +- cli/genpolicy/logtranslator.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cli/genpolicy/genpolicy.go b/cli/genpolicy/genpolicy.go index 21af4a3afd..8adfce53d1 100644 --- a/cli/genpolicy/genpolicy.go +++ b/cli/genpolicy/genpolicy.go @@ -62,7 +62,7 @@ func (r *Runner) Run(ctx context.Context, yamlPath string, logger *slog.Logger) genpolicy := exec.CommandContext(ctx, r.genpolicy.Path(), args...) genpolicy.Env = os.Environ() if _, hasRustLog := os.LookupEnv("RUST_LOG"); !hasRustLog { - genpolicy.Env = append(genpolicy.Env, "RUST_LOG=info") + genpolicy.Env = append(genpolicy.Env, "RUST_LOG=debug") } if _, hasRustBacktrace := os.LookupEnv("RUST_BACKTRACE"); !hasRustBacktrace { genpolicy.Env = append(genpolicy.Env, "RUST_BACKTRACE=1") diff --git a/cli/genpolicy/logtranslator.go b/cli/genpolicy/logtranslator.go index 8587f5c3d9..8f7d585349 100644 --- a/cli/genpolicy/logtranslator.go +++ b/cli/genpolicy/logtranslator.go @@ -51,7 +51,9 @@ func (l logTranslator) startTranslate() { l.logger.Error(match[3], "position", match[2]) case "WARN": l.logger.Warn(match[3], "position", match[2]) - case "INFO": // prints quite a lot, only show on debug + case "INFO": + fallthrough // prints quite a lot, only show on debug + case "DEBUG": l.logger.Debug(match[3], "position", match[2]) } }