Skip to content

Commit

Permalink
cli: genpolicy: Include log-level 'debug' into Contrast Logs
Browse files Browse the repository at this point in the history
  • Loading branch information
jmxnzo committed Dec 3, 2024
1 parent 8dd3f38 commit bb071e5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cli/genpolicy/genpolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 3 additions & 1 deletion cli/genpolicy/logtranslator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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])
}
}
Expand Down

0 comments on commit bb071e5

Please sign in to comment.