used logger custom interface instead of grpclog.LoggerV2

This commit is contained in:
Evgeniy Kulikov 2020-03-03 13:36:20 +03:00
parent 50e74ee3a1
commit 2db83caf29
No known key found for this signature in database
GPG key ID: BF6AEE0A2A699BF2

View file

@ -10,10 +10,17 @@ import (
"go.uber.org/zap/zapcore" "go.uber.org/zap/zapcore"
) )
type zapLogger struct { type (
zapcore.Core zapLogger struct {
log *zap.SugaredLogger zapcore.Core
} log *zap.SugaredLogger
}
logger interface {
grpclog.LoggerV2
Println(v ...interface{})
}
)
const ( const (
formatJSON = "json" formatJSON = "json"
@ -23,7 +30,7 @@ const (
defaultSamplingThereafter = 100 defaultSamplingThereafter = 100
) )
func gRPCLogger(l *zap.Logger) grpclog.LoggerV2 { func gRPCLogger(l *zap.Logger) logger {
log := l.WithOptions( log := l.WithOptions(
// skip gRPCLog + zapLogger in caller // skip gRPCLog + zapLogger in caller
zap.AddCallerSkip(2)) zap.AddCallerSkip(2))