Add structured logging with verbosity levels #23
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The bot currently uses bare
log.Printffor all output — warnings, debug info, and status messages are indistinguishable. When something goes wrong (like the token scope issue in PR #22), the CI logs bury the important warning in noise.Current state
log.Printf/log.FatalfGetAuthenticatedUserfails — only visible if you grep CI logs for "Warning"Proposal
--log-level/LOG_LEVELflag (error, warn, info, debug)slog(stdlib, Go 1.21+) for structured logginginfo(current behavior)infoby default,debugavailable for troubleshootingContext
Discovered in PR #22: the reviewer tokens lacked
read:userscope, soGetAuthenticatedUserreturned 403. The delete-existing feature silently fell through to posting a new review. This was only visible deep in CI logs as a single warning line. Structured logging with proper levels would make this immediately obvious.Acceptance criteria
log.Printfwithslogthroughout--log-levelflag with env var support