Compare commits

...

3 Commits

Author SHA1 Message Date
Manu NALEPA
6fa5515cea Add changelog. 2026-02-02 13:33:56 +01:00
Manu NALEPA
981ea8ef3b "Synced new block" log: Add slotInEpoch and sinceSlotStartTime in INFO log. 2026-02-02 13:18:17 +01:00
Manu NALEPA
5b513fe3be "Synced new block" log: Always use INFO, but add additional data if the log level is higher than DEBUG. 2026-02-02 13:17:31 +01:00
2 changed files with 21 additions and 21 deletions

View File

@@ -87,36 +87,32 @@ func logStateTransitionData(b interfaces.ReadOnlyBeaconBlock) error {
func logBlockSyncStatus(block interfaces.ReadOnlyBeaconBlock, blockRoot [32]byte, justified, finalized *ethpb.Checkpoint, receivedTime time.Time, genesis time.Time, daWaitedTime time.Duration) error {
startTime, err := slots.StartTime(genesis, block.Slot())
if err != nil {
return err
return fmt.Errorf("start time: %w", err)
}
level := log.Logger.GetLevel()
if level >= logrus.DebugLevel {
log := log.WithFields(logrus.Fields{
"slot": block.Slot(),
"block": fmt.Sprintf("0x%s...", hex.EncodeToString(blockRoot[:])[:8]),
"finalizedEpoch": finalized.Epoch,
"finalizedRoot": fmt.Sprintf("0x%s...", hex.EncodeToString(finalized.Root)[:8]),
"epoch": slots.ToEpoch(block.Slot()),
"slotInEpoch": block.Slot() % params.BeaconConfig().SlotsPerEpoch,
"sinceSlotStartTime": prysmTime.Now().Sub(startTime),
})
if log.Logger.GetLevel() >= logrus.DebugLevel {
parentRoot := block.ParentRoot()
lf := logrus.Fields{
"slot": block.Slot(),
"slotInEpoch": block.Slot() % params.BeaconConfig().SlotsPerEpoch,
"block": fmt.Sprintf("0x%s...", hex.EncodeToString(blockRoot[:])[:8]),
"epoch": slots.ToEpoch(block.Slot()),
log = log.WithFields(logrus.Fields{
"justifiedEpoch": justified.Epoch,
"justifiedRoot": fmt.Sprintf("0x%s...", hex.EncodeToString(justified.Root)[:8]),
"finalizedEpoch": finalized.Epoch,
"finalizedRoot": fmt.Sprintf("0x%s...", hex.EncodeToString(finalized.Root)[:8]),
"parentRoot": fmt.Sprintf("0x%s...", hex.EncodeToString(parentRoot[:])[:8]),
"version": version.String(block.Version()),
"sinceSlotStartTime": prysmTime.Now().Sub(startTime),
"chainServiceProcessedTime": prysmTime.Now().Sub(receivedTime) - daWaitedTime,
"dataAvailabilityWaitedTime": daWaitedTime,
}
log.WithFields(lf).Debug("Synced new block")
} else {
log.WithFields(logrus.Fields{
"slot": block.Slot(),
"block": fmt.Sprintf("0x%s...", hex.EncodeToString(blockRoot[:])[:8]),
"finalizedEpoch": finalized.Epoch,
"finalizedRoot": fmt.Sprintf("0x%s...", hex.EncodeToString(finalized.Root)[:8]),
"epoch": slots.ToEpoch(block.Slot()),
}).Info("Synced new block")
})
}
log.Info("Synced new block")
return nil
}

View File

@@ -0,0 +1,4 @@
### Changed
- Always use `INFO` for the "Synced new block" log, but add additional data if the verbosity is set to `debug` or higher.
- Add `slotInEpoch` and `sinceSlotStartTime` fields to the "Synced new block" INFO log.