Conversation
📝 WalkthroughWalkthroughThe PR updates HTTP client logging in the Resty utility to use status-code-driven severity: 2xx/3xx responses log at debug level, 4xx at warn, and 5xx at error; transport errors log at error level. Test coverage verifies the dynamic severity selection and status code field presence. ChangesStatus-Driven HTTP Logging
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
8f3ef33 to
ab47802
Compare
…l/Employee Two changes: 1. logError uses slog.Error instead of slog.Debug, matching the codebase convention (mongoutil.Disconnect, natsutil.Reply/Ack, natsrouter handler-error all use Error). @mliu33 PR #157 review. 2. Delete pkg/model/employee.go entirely. The struct had zero callers in the repo. No replacement; bring back when a real user shows up. logResponse stays at slog.Debug -- status code was already in the log fields (logFields includes resp.StatusCode), no level change needed beyond what @mliu33 actually requested.
ab47802 to
f94553c
Compare
Summary
Two changes:
logError→slog.Error(per @mliu33's review on PR feat(pkg): natsrouter improvements + mongoutil bulk API + new minioutil #157). The codebase convention for "we attempted an operation and it returned an error" is consistentlyslog.Error(mongoutil.Disconnect,natsutil.Reply,natsutil.Ack,natsrouterhandler-error). Transport-level failures from resty'sOnError(connect refused, DNS, ctx-deadline) fit that pattern. Was hiding real outages behind--debug.Delete
pkg/model/employee.go. Zero callers in the repo; bring it back when a real consumer shows up.On @mliu33's Q2 ("include
resp.StatusCodewhen logging error response")Already satisfied by the existing code —
logResponsecallslogFields(req, resp.StatusCode(), ...)which appends astatusfield on every record. No code change needed there;logResponsestays atslog.Debug.Test plan
TestLog_FiresOnTransportErrorstrengthened with a"level":"ERROR"assertionmake test— 10 restyutil tests passgo build ./...andgo build -tags=integration ./...— exit 0make lint— 0 issuesgrep -rn "model\.Employee" --include="*.go"— zero hits before deletionDiff
pkg/restyutil/restyutil.go+1 / -1,pkg/restyutil/restyutil_test.go+1 / -1,pkg/model/employee.godeleted (-91 lines).https://claude.ai/code/session_01Ngkd45NdAxeqX4FU4t6w9X