mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-11 18:04:18 +00:00
Visualisation logging for sync batch states (#6034)
* Add visualization for batch states * Replace icons with emojis * Reviewers comments * Change empty emoji and improve docs comments * Fix lints * Move to letters rather than emojis * Replace 'V' with 'v'. Cargo update * Merge latest unstable * Improve docs around visualisation * Merge branch 'unstable' into sync-batch-state
This commit is contained in:
@@ -463,6 +463,11 @@ impl<E: EthSpec, B: BatchConfig> BatchInfo<E, B> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Visualizes the state of this batch using state::visualize()
|
||||
pub fn visualize(&self) -> char {
|
||||
self.state.visualize()
|
||||
}
|
||||
}
|
||||
|
||||
/// Represents a peer's attempt and providing the result for this batch.
|
||||
@@ -539,3 +544,19 @@ impl<E: EthSpec> std::fmt::Debug for BatchState<E> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: EthSpec> BatchState<E> {
|
||||
/// Creates a character representation/visualization for the batch state to display in logs for quicker and
|
||||
/// easier recognition
|
||||
fn visualize(&self) -> char {
|
||||
match self {
|
||||
BatchState::Downloading(..) => 'D',
|
||||
BatchState::Processing(_) => 'P',
|
||||
BatchState::AwaitingValidation(_) => 'v',
|
||||
BatchState::AwaitingDownload => 'd',
|
||||
BatchState::Failed => 'F',
|
||||
BatchState::AwaitingProcessing(..) => 'p',
|
||||
BatchState::Poisoned => 'X',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user