Skip to content

Commit

Permalink
Code review rework
Browse files Browse the repository at this point in the history
  • Loading branch information
bruce-riley committed Aug 14, 2024
1 parent d1db6fd commit bccc0eb
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions node/pkg/p2p/p2p.go
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ func Run(params *RunParams) func(ctx context.Context) error {
gs := params.gst.Get()
if gs == nil {
// No valid guardian set yet - dropping heartbeat
if logger.Core().Enabled(params.components.SignedHeartbeatLogLevel) {
if logger.Level().Enabled(params.components.SignedHeartbeatLogLevel) {
logger.Log(params.components.SignedHeartbeatLogLevel, "skipping heartbeat - no guardian set",
zap.Any("value", s),
zap.String("from", envelope.GetFrom().String()))
Expand All @@ -769,7 +769,7 @@ func Run(params *RunParams) func(ctx context.Context) error {
}
if heartbeat, err := processSignedHeartbeat(envelope.GetFrom(), s, gs, params.gst, params.disableHeartbeatVerify); err != nil {
p2pMessagesReceived.WithLabelValues("invalid_heartbeat").Inc()
if logger.Core().Enabled(params.components.SignedHeartbeatLogLevel) {
if logger.Level().Enabled(params.components.SignedHeartbeatLogLevel) {
logger.Log(params.components.SignedHeartbeatLogLevel, "invalid signed heartbeat received",
zap.Error(err),
zap.Any("payload", msg.Message),
Expand All @@ -779,7 +779,7 @@ func Run(params *RunParams) func(ctx context.Context) error {
}
} else {
p2pMessagesReceived.WithLabelValues("valid_heartbeat").Inc()
if logger.Core().Enabled(params.components.SignedHeartbeatLogLevel) {
if logger.Level().Enabled(params.components.SignedHeartbeatLogLevel) {
logger.Log(params.components.SignedHeartbeatLogLevel, "valid signed heartbeat received",
zap.Any("value", heartbeat),
zap.String("from", envelope.GetFrom().String()))
Expand Down Expand Up @@ -987,7 +987,7 @@ func Run(params *RunParams) func(ctx context.Context) error {
gs := params.gst.Get()
if gs == nil {
// No valid guardian set yet - dropping heartbeat
if logger.Core().Enabled(params.components.SignedHeartbeatLogLevel) {
if logger.Level().Enabled(params.components.SignedHeartbeatLogLevel) {
logger.Log(params.components.SignedHeartbeatLogLevel, "skipping heartbeat - no guardian set",
zap.Any("value", s),
zap.String("from", envelope.GetFrom().String()))
Expand All @@ -996,7 +996,7 @@ func Run(params *RunParams) func(ctx context.Context) error {
}
if heartbeat, err := processSignedHeartbeat(envelope.GetFrom(), s, gs, params.gst, params.disableHeartbeatVerify); err != nil {
p2pMessagesReceived.WithLabelValues("invalid_heartbeat").Inc()
if logger.Core().Enabled(params.components.SignedHeartbeatLogLevel) {
if logger.Level().Enabled(params.components.SignedHeartbeatLogLevel) {
logger.Log(params.components.SignedHeartbeatLogLevel, "invalid signed heartbeat received",
zap.Error(err),
zap.Any("payload", msg.Message),
Expand All @@ -1006,7 +1006,7 @@ func Run(params *RunParams) func(ctx context.Context) error {
}
} else {
p2pMessagesReceived.WithLabelValues("valid_heartbeat").Inc()
if logger.Core().Enabled(params.components.SignedHeartbeatLogLevel) {
if logger.Level().Enabled(params.components.SignedHeartbeatLogLevel) {
logger.Log(params.components.SignedHeartbeatLogLevel, "valid signed heartbeat received",
zap.Any("value", heartbeat),
zap.String("from", envelope.GetFrom().String()))
Expand Down

0 comments on commit bccc0eb

Please sign in to comment.