used logger custom interface instead of grpclog.LoggerV2
This commit is contained in:
parent
50e74ee3a1
commit
2db83caf29
1 changed files with 12 additions and 5 deletions
17
logger.go
17
logger.go
|
@ -10,10 +10,17 @@ import (
|
|||
"go.uber.org/zap/zapcore"
|
||||
)
|
||||
|
||||
type zapLogger struct {
|
||||
zapcore.Core
|
||||
log *zap.SugaredLogger
|
||||
}
|
||||
type (
|
||||
zapLogger struct {
|
||||
zapcore.Core
|
||||
log *zap.SugaredLogger
|
||||
}
|
||||
|
||||
logger interface {
|
||||
grpclog.LoggerV2
|
||||
Println(v ...interface{})
|
||||
}
|
||||
)
|
||||
|
||||
const (
|
||||
formatJSON = "json"
|
||||
|
@ -23,7 +30,7 @@ const (
|
|||
defaultSamplingThereafter = 100
|
||||
)
|
||||
|
||||
func gRPCLogger(l *zap.Logger) grpclog.LoggerV2 {
|
||||
func gRPCLogger(l *zap.Logger) logger {
|
||||
log := l.WithOptions(
|
||||
// skip gRPCLog + zapLogger in caller
|
||||
zap.AddCallerSkip(2))
|
||||
|
|
Loading…
Reference in a new issue