-
Notifications
You must be signed in to change notification settings - Fork 8
/
logger.go
39 lines (31 loc) · 971 Bytes
/
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
package logger
var internalLogger GenericLogger = NewZeroLogger()
// SetLogger sets the internal logger to the one provided
func SetLogger(newLogger GenericLogger) {
internalLogger = newLogger
}
// GetLogger returns the internal logger
func GetLogger() GenericLogger {
return internalLogger
}
// Debug calls the debug method of the registered logger
func Debug() GenericContext {
return internalLogger.Debug()
}
//Info calls the info method of the registered logger
func Info() GenericContext {
return internalLogger.Info()
}
// Warn calls the warn method of the registered logger
func Warn() GenericContext {
return internalLogger.Warn()
}
// Error calls the error method of the registered logger
func Error() GenericContext {
return internalLogger.Error()
}
// With calls the with method of the registered logger, and returns
// a logger with those fields attached by default
func With(gc GenericContext) GenericLogger {
return internalLogger.With(gc)
}