File tree 2 files changed +7
-6
lines changed
2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -39,4 +39,10 @@ type (
39
39
WithSkipCallers interface {
40
40
WithCallerSkip (int ) Logger
41
41
}
42
+
43
+ // WithLogger is an optional interface that prepend every log entry with keyvals.
44
+ // This call must not mutate the original logger.
45
+ WithLogger interface {
46
+ With (keyvals ... interface {}) Logger
47
+ }
42
48
)
Original file line number Diff line number Diff line change 24
24
25
25
package log
26
26
27
- // WithLogger is an interface that prepend every log entry with keyvals.
28
- type WithLogger interface {
29
- With (keyvals ... interface {}) Logger
30
- }
31
-
32
27
// With creates a child Logger that includes the supplied key-value pairs in each log entry. It does this by
33
28
// using the supplied logger if it implements WithLogger; otherwise, it does so by intercepting every log call.
34
29
func With (logger Logger , keyvals ... interface {}) Logger {
@@ -57,7 +52,7 @@ type withLogger struct {
57
52
}
58
53
59
54
func newWithLogger (logger Logger , keyvals ... interface {}) * withLogger {
60
- return & withLogger {logger : logger , keyvals : keyvals }
55
+ return & withLogger {logger : Skip ( logger , 1 ) , keyvals : keyvals }
61
56
}
62
57
63
58
func (l * withLogger ) prependKeyvals (keyvals []interface {}) []interface {} {
You can’t perform that action at this time.
0 commit comments