allow nil metric

This commit is contained in:
Sergey Cherepanov 2023-05-04 19:30:46 +02:00
parent debbf448db
commit a12f3fb0dd
No known key found for this signature in database
GPG Key ID: 87F8EDE8FBDF637C

View File

@ -52,6 +52,9 @@ func Size(size int) zap.Field {
} }
func (m *metric) RequestLog(ctx context.Context, rpc string, fields ...zap.Field) { func (m *metric) RequestLog(ctx context.Context, rpc string, fields ...zap.Field) {
if m == nil {
return
}
peerId, _ := peer.CtxPeerId(ctx) peerId, _ := peer.CtxPeerId(ctx)
ak, _ := peer.CtxPubKey(ctx) ak, _ := peer.CtxPubKey(ctx)
var acc string var acc string