mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-09 19:51:47 +00:00
No string in slog (#2017)
## Issue Addressed Following slog's documentation, this should help a bit with string allocations. I left it run for two days and mem usage is lower. This is of course anecdotal, but shouldn't harm anyway ## Proposed Changes remove `String` creation in logs when possible
This commit is contained in:
@@ -125,7 +125,7 @@ impl<T: EthSpec> SyncNetworkContext<T> {
|
||||
"Sending BlocksByRoot Request";
|
||||
"method" => "BlocksByRoot",
|
||||
"count" => request.block_roots.len(),
|
||||
"peer" => format!("{:?}", peer_id)
|
||||
"peer" => %peer_id
|
||||
);
|
||||
self.send_rpc_request(peer_id, Request::BlocksByRoot(request))
|
||||
}
|
||||
@@ -139,11 +139,11 @@ impl<T: EthSpec> SyncNetworkContext<T> {
|
||||
}
|
||||
|
||||
pub fn report_peer(&mut self, peer_id: PeerId, action: PeerAction) {
|
||||
debug!(self.log, "Sync reporting peer"; "peer_id" => peer_id.to_string(), "action" => action.to_string());
|
||||
debug!(self.log, "Sync reporting peer"; "peer_id" => %peer_id, "action" => %action);
|
||||
self.network_send
|
||||
.send(NetworkMessage::ReportPeer { peer_id, action })
|
||||
.unwrap_or_else(|e| {
|
||||
warn!(self.log, "Could not report peer, channel failed"; "error"=> e.to_string());
|
||||
warn!(self.log, "Could not report peer, channel failed"; "error"=> %e);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ impl<T: EthSpec> SyncNetworkContext<T> {
|
||||
self.network_send
|
||||
.send(NetworkMessage::SubscribeCoreTopics)
|
||||
.unwrap_or_else(|e| {
|
||||
warn!(self.log, "Could not subscribe to core topics."; "error" => e.to_string());
|
||||
warn!(self.log, "Could not subscribe to core topics."; "error" => %e);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user