-
Notifications
You must be signed in to change notification settings - Fork 0
/
log_global.go
47 lines (36 loc) · 1.19 KB
/
log_global.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
package log
import "context"
var global Logger
// SetGlobalLogger sets the Logger instance used in global scope.
// Must be called during initialization as early as possible.
// It's not thread safe.
func SetGlobalLogger(l Logger) {
global = l
}
// GlobalLogger gets the Logger instance used in global scope.
// It's not thread safe.
func GlobalLogger() Logger {
return global
}
func Debug(ctx context.Context, msg string, keysAndValues ...interface{}) {
global.Debug(ctx, msg, keysAndValues...)
}
func Info(ctx context.Context, msg string, keysAndValues ...interface{}) {
global.Info(ctx, msg, keysAndValues...)
}
func Warn(ctx context.Context, msg string, keysAndValues ...interface{}) {
global.Warn(ctx, msg, keysAndValues...)
}
func Error(ctx context.Context, msg string, keysAndValues ...interface{}) {
global.Error(ctx, msg, keysAndValues...)
}
func Panic(ctx context.Context, msg string, keysAndValues ...interface{}) {
global.Panic(ctx, msg, keysAndValues...)
}
func IsDebug(ctx context.Context) bool {
return global.IsDebug(ctx)
}
// Dump should be used only during development and should not stay in production code.
func Dump(msg string, v ...interface{}) {
global.Dump(msg, v...)
}