Clean up logs (#1541)
## Description This PR improves some logging for the end-user. It downgrades some warning logs and removes the slots per second sync speed if we are syncing and the speed is 0. This is likely because we are syncing from a finalised checkpoint and the head doesn't change.
This commit is contained in:
parent
d4f763bbae
commit
2d0b214b57
@ -122,14 +122,28 @@ pub fn spawn_notifier<T: BeaconChainTypes>(
|
|||||||
head_distance.as_u64(),
|
head_distance.as_u64(),
|
||||||
slot_distance_pretty(head_distance, slot_duration)
|
slot_distance_pretty(head_distance, slot_duration)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let speed = speedo.slots_per_second();
|
||||||
|
let display_speed = speed.map_or(false, |speed| speed != 0.0);
|
||||||
|
|
||||||
|
if display_speed {
|
||||||
info!(
|
info!(
|
||||||
log,
|
log,
|
||||||
"Syncing";
|
"Syncing";
|
||||||
"peers" => peer_count_pretty(connected_peer_count),
|
"peers" => peer_count_pretty(connected_peer_count),
|
||||||
"distance" => distance,
|
"distance" => distance,
|
||||||
"speed" => sync_speed_pretty(speedo.slots_per_second()),
|
"speed" => sync_speed_pretty(speed),
|
||||||
"est_time" => estimated_time_pretty(speedo.estimated_time_till_slot(current_slot)),
|
"est_time" => estimated_time_pretty(speedo.estimated_time_till_slot(current_slot)),
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
info!(
|
||||||
|
log,
|
||||||
|
"Syncing";
|
||||||
|
"peers" => peer_count_pretty(connected_peer_count),
|
||||||
|
"distance" => distance,
|
||||||
|
"est_time" => estimated_time_pretty(speedo.estimated_time_till_slot(current_slot)),
|
||||||
|
);
|
||||||
|
}
|
||||||
} else if sync_state.is_synced() {
|
} else if sync_state.is_synced() {
|
||||||
let block_info = if current_slot > head_slot {
|
let block_info = if current_slot > head_slot {
|
||||||
" … empty".to_string()
|
" … empty".to_string()
|
||||||
@ -220,14 +234,37 @@ fn seconds_pretty(secs: f64) -> String {
|
|||||||
let hours = d.whole_hours();
|
let hours = d.whole_hours();
|
||||||
let minutes = d.whole_minutes();
|
let minutes = d.whole_minutes();
|
||||||
|
|
||||||
|
let week_string = if weeks == 1 { "week" } else { "weeks" };
|
||||||
|
let day_string = if days == 1 { "day" } else { "days" };
|
||||||
|
let hour_string = if hours == 1 { "hr" } else { "hrs" };
|
||||||
|
let min_string = if minutes == 1 { "min" } else { "mins" };
|
||||||
|
|
||||||
if weeks > 0 {
|
if weeks > 0 {
|
||||||
format!("{:.0} weeks {:.0} days", weeks, days % DAYS_PER_WEEK)
|
format!(
|
||||||
|
"{:.0} {} {:.0} {}",
|
||||||
|
weeks,
|
||||||
|
week_string,
|
||||||
|
days % DAYS_PER_WEEK,
|
||||||
|
day_string
|
||||||
|
)
|
||||||
} else if days > 0 {
|
} else if days > 0 {
|
||||||
format!("{:.0} days {:.0} hrs", days, hours % HOURS_PER_DAY)
|
format!(
|
||||||
|
"{:.0} {} {:.0} {}",
|
||||||
|
days,
|
||||||
|
day_string,
|
||||||
|
hours % HOURS_PER_DAY,
|
||||||
|
hour_string
|
||||||
|
)
|
||||||
} else if hours > 0 {
|
} else if hours > 0 {
|
||||||
format!("{:.0} hrs {:.0} mins", hours, minutes % MINUTES_PER_HOUR)
|
format!(
|
||||||
|
"{:.0} {} {:.0} {}",
|
||||||
|
hours,
|
||||||
|
hour_string,
|
||||||
|
minutes % MINUTES_PER_HOUR,
|
||||||
|
min_string
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
format!("{:.0} mins", minutes)
|
format!("{:.0} {}", minutes, min_string)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ pub fn handle_chain_segment<T: BeaconChainTypes>(
|
|||||||
// reverse
|
// reverse
|
||||||
match process_blocks(chain, downloaded_blocks.iter().rev(), &log) {
|
match process_blocks(chain, downloaded_blocks.iter().rev(), &log) {
|
||||||
(_, Err(e)) => {
|
(_, Err(e)) => {
|
||||||
warn!(log, "Parent lookup failed"; "last_peer_id" => format!("{}", peer_id), "error" => e);
|
debug!(log, "Parent lookup failed"; "last_peer_id" => format!("{}", peer_id), "error" => e);
|
||||||
sync_send
|
sync_send
|
||||||
.send(SyncMessage::ParentLookupFailed{peer_id, chain_head})
|
.send(SyncMessage::ParentLookupFailed{peer_id, chain_head})
|
||||||
.unwrap_or_else(|_| {
|
.unwrap_or_else(|_| {
|
||||||
|
@ -774,6 +774,13 @@ impl<T: BeaconChainTypes> BeaconProcessor<T> {
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Err(BlockError::BlockIsAlreadyKnown) => {
|
||||||
|
debug!(
|
||||||
|
log,
|
||||||
|
"Gossip block is already known";
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
warn!(
|
warn!(
|
||||||
log,
|
log,
|
||||||
|
Loading…
Reference in New Issue
Block a user