-
Notifications
You must be signed in to change notification settings - Fork 1
/
rzlog.go
96 lines (74 loc) · 2.43 KB
/
rzlog.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
package rzlog
import (
"context"
"net/http"
"github.com/twitchtv/twirp"
"google.golang.org/grpc"
)
func Error(ctx context.Context, err error, args ...interface{}) {
getLogger().Error(ctx, err, args...)
}
func Warn(ctx context.Context, args ...interface{}) {
getLogger().Warn(ctx, args...)
}
func Info(ctx context.Context, args ...interface{}) {
getLogger().Info(ctx, args...)
}
func Debug(ctx context.Context, args ...interface{}) {
getLogger().Debug(ctx, args...)
}
func Errorf(ctx context.Context, err error, msg string, args ...interface{}) {
getLogger().Errorf(ctx, err, msg, args...)
}
func Warnf(ctx context.Context, msg string, args ...interface{}) {
getLogger().Warnf(ctx, msg, args...)
}
func Infof(ctx context.Context, msg string, args ...interface{}) {
getLogger().Infof(ctx, msg, args...)
}
func Debugf(ctx context.Context, msg string, args ...interface{}) {
getLogger().Debugf(ctx, msg, args...)
}
func ErrorKV(ctx context.Context, err error, kv KV, args ...interface{}) {
getLogger().ErrorKV(ctx, err, kv, args...)
}
func WarnKV(ctx context.Context, kv KV, args ...interface{}) {
getLogger().WarnKV(ctx, kv, args...)
}
func InfoKV(ctx context.Context, kv KV, args ...interface{}) {
getLogger().InfoKV(ctx, kv, args...)
}
func DebugKV(ctx context.Context, kv KV, args ...interface{}) {
getLogger().DebugKV(ctx, kv, args...)
}
func ErrorKVf(ctx context.Context, err error, kv KV, msg string, args ...interface{}) {
getLogger().ErrorKVf(ctx, err, kv, msg, args...)
}
func WarnKVf(ctx context.Context, kv KV, msg string, args ...interface{}) {
getLogger().WarnKVf(ctx, kv, msg, args...)
}
func InfoKVf(ctx context.Context, kv KV, msg string, args ...interface{}) {
getLogger().InfoKVf(ctx, kv, msg, args...)
}
func DebugKVf(ctx context.Context, kv KV, msg string, args ...interface{}) {
getLogger().DebugKVf(ctx, kv, msg, args...)
}
func SetLogLevel(level string) error {
return getLogger().SetLogLevel(level)
}
func NewRequestLogger() func(next http.Handler) http.Handler {
logger := getLogger()
return logger.NewRequestLogger()
}
func UnaryServerInterceptor(opts ...Option) grpc.UnaryServerInterceptor {
logger := getLogger()
return logger.UnaryServerInterceptor()
}
func StreamServerInterceptor(opts ...Option) grpc.StreamServerInterceptor {
logger := getLogger()
return logger.StreamServerInterceptor()
}
func TwirpServerLoggingHook() *twirp.ServerHooks {
logger := getLogger()
return logger.TwirpServerLoggingHook()
}