Skip to content

Commit

Permalink
Improve logging
Browse files Browse the repository at this point in the history
  • Loading branch information
oleg-ssvlabs committed Feb 6, 2025
1 parent 5479826 commit 9227e09
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions beacon/goclient/attest.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,24 +233,23 @@ func (gc *GoClient) weightedAttestationData(slot phase0.Slot) (*phase0.Attestati
}
cancel()

gc.log.
With(
zap.Duration("elapsed", time.Since(started)),
zap.Int("responded", responded),
zap.Int("errored", errored),
zap.Int("timed_out", timedOut),
).Debug("results")

logger := gc.log.With(
zap.Duration("elapsed", time.Since(started)),
zap.Int("responded", responded),
zap.Int("errored", errored),
zap.Int("timed_out", timedOut),
zap.Bool("with_weighted_attestation_data", true),
)
if bestAttestationData == nil {
logger.Error("no attestations received")
return nil, fmt.Errorf("no attestations received")
}

gc.log.
logger.
With(
zap.String("client_addr", bestClient),
zap.Stringer("attestation_data", bestAttestationData),
zap.Float64("score", bestScore),
).Debug("selected best attestation")
zap.Float64("score", bestScore)).
Debug("successfully fetched attestation data")

return bestAttestationData, nil
}
Expand Down Expand Up @@ -283,6 +282,12 @@ func (gc *GoClient) simpleAttestationData(slot phase0.Slot) (*phase0.Attestation
return nil, fmt.Errorf("attestation data is nil")
}

Check warning on line 283 in beacon/goclient/attest.go

View check run for this annotation

Codecov / codecov/patch

beacon/goclient/attest.go#L279-L283

Added lines #L279 - L283 were not covered by tests

gc.log.
With(
zap.Duration("elapsed", time.Since(attDataReqStart)),
zap.Bool("with_weighted_attestation_data", false),
).Debug("successfully fetched attestation data")

return resp.Data, nil
}

Expand Down

0 comments on commit 9227e09

Please sign in to comment.