Add --log-level flag with log/slog structured logging#60
Conversation
smith-xyz
left a comment
There was a problem hiding this comment.
great addition! I do think this is a reasonable add but I'd request the following:
Consider using log/slog instead of a custom logging package. It gives you leveled logging, slog.SetDefault() for global config, and a single --log-level flag covers all cases without needing mutually exclusive --debug/--quiet. Less code to maintain and a standard interface other contributors already know.
|
Good idea, I can switch to |
d8eb68e to
43514a2
Compare
Migrate all log.Printf calls to Go's stdlib log/slog with structured key-value pairs. Replaces the standard log package with slog's leveled logging throughout the codebase. - --log-level flag accepts debug, info, warn, error (default: info) - Debug level enables verbose output including per-pod discovery detail, lsof output, and component analysis - Warn level suppresses informational messages - All log messages use idiomatic slog structured args for efficient filtering and machine-parseable output - Replace panic with error return in Policy() for graceful handling of policy parse failures
43514a2 to
7e2f0b2
Compare
|
I closed #52 and cherry-picked the changes into this one as they were similar. |
|
@sebrandon1: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
/lgtm thank you again @sebrandon1 for your contribution |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sebrandon1, smith-xyz The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Summary
log.Printfcalls to Go's stdliblog/slogwith structured key-value pairs--log-levelflag acceptingdebug,info,warn,error(default:info)panicwith error return inPolicy()for graceful handling of policy parse failures (supersedes Replace panic with error return in Policy() #52)log/slogis Go stdlibJira: https://redhat.atlassian.net/browse/CNF-23702