File tree 2 files changed +14
-1
lines changed
2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -206,6 +206,7 @@ func (l *richLogger) WithFields(fields ...LogField) Logger {
206
206
207
207
func (l * richLogger ) buildFields (fields ... LogField ) []LogField {
208
208
fields = append (l .fields , fields ... )
209
+ // caller field should always appear together with global fields
209
210
fields = append (fields , Field (callerKey , getCaller (callerDepth + l .callerSkip )))
210
211
fields = combineGlobalFields (fields )
211
212
@@ -235,7 +236,7 @@ func (l *richLogger) buildFields(fields ...LogField) []LogField {
235
236
236
237
func (l * richLogger ) debug (v any , fields ... LogField ) {
237
238
if shallLog (DebugLevel ) {
238
- getWriter ().Debug (v , ( l .buildFields (fields ... ) )... )
239
+ getWriter ().Debug (v , l .buildFields (fields ... )... )
239
240
}
240
241
}
241
242
Original file line number Diff line number Diff line change @@ -17,15 +17,27 @@ import (
17
17
)
18
18
19
19
type (
20
+ // Writer is the interface for writing logs.
21
+ // It's designed to let users customize their own log writer,
22
+ // such as writing logs to a kafka, a database, or using third-party loggers.
20
23
Writer interface {
24
+ // Alert sends an alert message, if your writer implemented alerting functionality.
21
25
Alert (v any )
26
+ // Close closes the writer.
22
27
Close () error
28
+ // Debug logs a message at debug level.
23
29
Debug (v any , fields ... LogField )
30
+ // Error logs a message at error level.
24
31
Error (v any , fields ... LogField )
32
+ // Info logs a message at info level.
25
33
Info (v any , fields ... LogField )
34
+ // Severe logs a message at severe level.
26
35
Severe (v any )
36
+ // Slow logs a message at slow level.
27
37
Slow (v any , fields ... LogField )
38
+ // Stack logs a message at error level.
28
39
Stack (v any )
40
+ // Stat logs a message at stat level.
29
41
Stat (v any , fields ... LogField )
30
42
}
31
43
You can’t perform that action at this time.
0 commit comments