@@ -14,25 +14,26 @@ import (
14
14
)
15
15
16
16
func Test_zapGrpcLogger_V (t * testing.T ) {
17
- // copied from gRPC
18
17
const (
19
- // infoLog indicates Info severity.
20
- infoLog int = iota
21
- // warningLog indicates Warning severity.
22
- warningLog
23
- // errorLog indicates Error severity.
24
- errorLog
25
- // fatalLog indicates Fatal severity.
26
- fatalLog
18
+ // The default verbosity level.
19
+ // See https://github.com/grpc/grpc-go/blob/8ab16ef276a33df4cdb106446eeff40ff56a6928/grpclog/loggerv2.go#L108.
20
+ normal = 0
21
+
22
+ // Currently the only level of "being verbose".
23
+ // For example https://github.com/grpc/grpc-go/blob/8ab16ef276a33df4cdb106446eeff40ff56a6928/grpclog/grpclog.go#L21.
24
+ verbose = 2
25
+
26
+ // As is mentioned in https://github.com/grpc/grpc-go/blob/8ab16ef276a33df4cdb106446eeff40ff56a6928/README.md#how-to-turn-on-logging,
27
+ // though currently not being used in the code.
28
+ extremelyVerbose = 99
27
29
)
28
30
29
31
core , _ := observer .New (zapcore .DebugLevel )
30
32
logger := zap .New (core )
31
- ReplaceGrpcLoggerV2WithVerbosity (logger , warningLog )
32
- assert .False (t , grpclog .V (infoLog ))
33
- assert .True (t , grpclog .V (warningLog ))
34
- assert .True (t , grpclog .V (errorLog ))
35
- assert .True (t , grpclog .V (fatalLog ))
33
+ ReplaceGrpcLoggerV2WithVerbosity (logger , verbose )
34
+ assert .True (t , grpclog .V (normal ))
35
+ assert .True (t , grpclog .V (verbose ))
36
+ assert .False (t , grpclog .V (extremelyVerbose ))
36
37
}
37
38
38
39
func TestReplaceGrpcLoggerV2 (t * testing.T ) {
0 commit comments