-
Notifications
You must be signed in to change notification settings - Fork 0
/
logger.go
80 lines (59 loc) · 2.17 KB
/
logger.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/**
* Author: Jason
* Email: jason_w96@163.com
* Date: 2023/7/3
* Time: 14:28
* Software: GoLand
*/
package kiko_logger
import (
"context"
"log"
)
type Logger interface {
// Options The Logger options
// Options() Option
// SetLevel set logger level
SetLevel(lv Level)
// WithContext with context
WithContext(ctx context.Context) Logger
// WithFields set fields to always be logged
WithFields(fields map[string]interface{}) Logger
// WithCallDepth with logger call depth.
WithCallDepth(callDepth int) Logger
// WithError with logger error
WithError(err error) Logger
// Debug uses fmt.Sprint to construct and log a message.
Debug(args ...interface{})
// Info uses fmt.Sprint to construct and log a message.
Info(args ...interface{})
// Warn uses fmt.Sprint to construct and log a message.
Warn(args ...interface{})
// Error uses fmt.Sprint to construct and log a message.
Error(args ...interface{})
// Fatal uses fmt.Sprint to construct and log a message, then calls os.Exit.
Fatal(args ...interface{})
// Debugf uses fmt.Sprintf to log a templated message.
Debugf(template string, args ...interface{})
// Infof uses fmt.Sprintf to log a templated message.
Infof(template string, args ...interface{})
// Warnf uses fmt.Sprintf to log a templated message.
Warnf(template string, args ...interface{})
// Errorf uses fmt.Sprintf to log a templated message.
Errorf(template string, args ...interface{})
// Fatalf uses fmt.Sprintf to log a templated message, then calls os.Exit.
Fatalf(template string, args ...interface{})
// Log writes a log entry
// Log(level Level, template string, fmtArgs []interface{}, context []interface{})
StdLog() *log.Logger
// Sync logger sync
Sync() error
// AddHooks Hooks registers functions which will be called each time the Logger writes
// out an Entry. Repeated use of Hooks is additive.
//
// Hooks are useful for simple side effects, like capturing metrics for the
// number of emitted logs. More complex side effects, including anything that
// requires access to the Entry's structured fields, should be implemented as
// a zapcore.Core instead. See zapcore.RegisterHooks for details.
// AddHooks(hooks ...Hook)
}