-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathlogrlint_compatiblity.go
28 lines (23 loc) · 1.02 KB
/
logrlint_compatiblity.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
//golangcitest:args -Elogrlint
package loggercheck
import (
"fmt"
"github.com/go-logr/logr"
"go.uber.org/zap"
"k8s.io/klog/v2"
)
func ExampleLogrlintLogr() {
log := logr.Discard()
log = log.WithValues("key") // want `odd number of arguments passed as key-value pairs for logging`
log.Info("message", "key1", "value1", "key2", "value2", "key3") // want `odd number of arguments passed as key-value pairs for logging`
log.Error(fmt.Errorf("error"), "message", "key1", "value1", "key2") // want `odd number of arguments passed as key-value pairs for logging`
log.Error(fmt.Errorf("error"), "message", "key1", "value1", "key2", "value2")
}
func ExampleLogrlintKlog() {
klog.InfoS("message", "key1") // want `odd number of arguments passed as key-value pairs for logging`
}
func ExampleLogrlintZapSugar() {
sugar := zap.NewExample().Sugar()
defer sugar.Sync()
sugar.Infow("message", "key1", "value1", "key2") // want `odd number of arguments passed as key-value pairs for logging`
}