-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkayvee_logger.go
110 lines (76 loc) · 3.41 KB
/
kayvee_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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
package logger
import (
"io"
"github.com/Clever/kayvee-go/v7/router"
)
/////////////////////////////
//
// KayveeLogger interface
//
/////////////////////////////
// KayveeLogger is the main logging interface, providing customization of log messages.
type KayveeLogger interface {
//
// Configuration
//
// AddContext adds a new key-val to be logged with all log messages.
AddContext(key, val string)
// GetContext reads a key-val from the global map of data that will be logged with all log messages.
GetContext(key string) (interface{}, bool)
// SetConfig allows configuration changes in one go
SetConfig(source string, logLvl LogLevel, formatter Formatter, output io.Writer)
// SetFormatter sets the formatter function to use
SetFormatter(formatter Formatter)
// SetLogLevel sets the default log level threshold
SetLogLevel(logLvl LogLevel)
// SetOutput changes the output destination of the logger
SetOutput(output io.Writer)
// setFormatLogger use for to implemente the mock
setFormatLogger(fl formatLogger)
// SetRouter changes the router for this logger instance. Once set, logs produced by this
// logger will not be touched by the global router. Mostly used for testing and benchmarking.
SetRouter(router router.Router)
//
// Logging
//
// Counter takes a string and logs with LogLevel = Info
Counter(title string)
// CounterD takes a string, value, and data map. It logs with LogLevel = Info
CounterD(title string, value int, data map[string]interface{})
// Critical takes a string and logs with LogLevel = Critical
Critical(title string)
// CriticalD takes a string and data map. It logs with LogLevel = Critical
CriticalD(title string, data map[string]interface{})
// Trace takes a string and logs with LogLevel = Trace
Trace(title string)
// TraceD takes a string and data map. It logs with LogLevel = Trace
TraceD(title string, data map[string]interface{})
// Debug takes a string and logs with LogLevel = Debug
Debug(title string)
// DebugD takes a string and data map. It logs with LogLevel = Debug
DebugD(title string, data map[string]interface{})
// Error takes a string and logs with LogLevel = Error
Error(title string)
// ErrorD takes a string and data map. It logs with LogLevel = Error
ErrorD(title string, data map[string]interface{})
// GaugeFloat takes a string and float value. It logs with LogLevel = Info
GaugeFloat(title string, value float64)
// GaugeFloatD takes a string, a float value, and data map. It logs with LogLevel = Info
GaugeFloatD(title string, value float64, data map[string]interface{})
// GaugeInt takes a string and integer value. It logs with LogLevel = Info
GaugeInt(title string, value int)
// GaugeIntD takes a string, an integer value, and data map. It logs with LogLevel = Info
GaugeIntD(title string, value int, data map[string]interface{})
// Info takes a string and logs with LogLevel = Info
Info(title string)
// InfoD takes a string and data map. It logs with LogLevel = Info
InfoD(title string, data map[string]interface{})
// Timer takes a string and logs with LogLevel = Debug
Timer(title string) *Timer
// TimerD takes a string and data map. It logs with LogLevel = Debug
TimerD(title string, data map[string]interface{}) *Timer
// Warn takes a string and logs with LogLevel = Warning
Warn(title string)
// WarnD takes a string and data map. It logs with LogLevel = Warning
WarnD(title string, data map[string]interface{})
}