add AddCallerSkip(1) so we aren't having the logger log itself#2182
add AddCallerSkip(1) so we aren't having the logger log itself#2182matthewlouisbrockman wants to merge 3 commits intomainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8f6b10a44e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| zap.AddCaller(), | ||
| zap.AddCallerSkip(1), | ||
| ) | ||
| } |
There was a problem hiding this comment.
Detach() leaks AddCallerSkip(1) to direct logger consumers
Low Severity
withTraceLoggerOptions embeds AddCallerSkip(1) into the inner *zap.Logger, which is designed to skip the TracedLogger wrapper. However, Detach() exposes this inner logger directly. Callers that use the detached logger without a TracedLogger wrapper (e.g., zapio.Writer in process.go) will have their reported caller shifted by one extra frame, since there's no wrapper frame to skip. Callers using .Core() are unaffected since core extraction discards options.


cleans up logs by logging the root location the log occured rather than the location of the logger
previous behavior for, e.g.
Cluster instances: Failed to synchronizewould show the lgger as the code logging:now, we get what actually called the logger
Note
Low Risk
Low risk: changes only logging metadata (caller attribution) and adds tests, but it may affect downstream log parsing/alerting that depends on caller fields.
Overview
Updates
TracedLoggerconstruction to always enable caller reporting withzap.AddCallerSkip(1)so logs point at the original call site instead of the wrapper, whileGRPCLoggernow disables caller emission to avoid incorrect gRPC middleware attribution; adds tests to ensure caller file/line are correct and thatL()doesn’t double-apply caller skipping afterReplaceGlobals.Written by Cursor Bugbot for commit b9136c6. This will update automatically on new commits. Configure here.