zap
zap copied to clipboard
Refactor cloned logger variable names in Sugar and WithOptions
Summary
This refactors local variable names in Logger.Sugar and Logger.WithOptions to better reflect their actual type and usage.
Previously, the cloned *Logger instance was stored in variables named core and c, which can be misleading because:
-
coresuggests azapcore.Corerather than a*Logger -
cis not very descriptive in this context
Now both methods consistently use l (for logger) as the local variable name.
Changes
func (log *Logger) Sugar() *SugaredLogger {
- core := log.clone()
- core.callerSkip += 2
- return &SugaredLogger{core}
+ l := log.clone()
+ l.callerSkip += 2
+ return &SugaredLogger{l}
}
func (log *Logger) WithOptions(opts ...Option) *Logger {
- c := log.clone()
- for _, opt := range opts {
- opt.apply(c)
- }
- return c
+ l := log.clone()
+ for _, opt := range opts {
+ opt.apply(l)
+ }
+ return l
}
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 98.61%. Comparing base (7b755a3) to head (ad0cf92).
Additional details and impacted files
@@ Coverage Diff @@
## master #1523 +/- ##
=======================================
Coverage 98.61% 98.61%
=======================================
Files 53 53
Lines 3033 3033
=======================================
Hits 2991 2991
Misses 34 34
Partials 8 8
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.