Remove unnecessary logging and correct formatting

This commit is contained in:
Age Manning
2019-11-28 15:05:25 +11:00
parent 6f2fc7560a
commit c78fe81a89
5 changed files with 14 additions and 29 deletions

View File

@@ -664,7 +664,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
}); });
} }
other => { other => {
warn!( trace!(
self.log, self.log,
"Beacon attestation rejected"; "Beacon attestation rejected";
"reason" => format!("{:?}", other), "reason" => format!("{:?}", other),
@@ -1019,7 +1019,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
}); });
} }
other => { other => {
warn!( trace!(
self.log, self.log,
"Beacon block rejected"; "Beacon block rejected";
"reason" => format!("{:?}", other), "reason" => format!("{:?}", other),

View File

@@ -173,11 +173,11 @@ impl<TSubstream: AsyncRead + AsyncWrite> NetworkBehaviourEventProcess<IdentifyEv
info.listen_addrs.truncate(MAX_IDENTIFY_ADDRESSES); info.listen_addrs.truncate(MAX_IDENTIFY_ADDRESSES);
} }
debug!(self.log, "Identified Peer"; "Peer" => format!("{}", peer_id), debug!(self.log, "Identified Peer"; "Peer" => format!("{}", peer_id),
"Protocol Version" => info.protocol_version, "protocol_version" => info.protocol_version,
"Agent Version" => info.agent_version, "agent_version" => info.agent_version,
"Listening Addresses" => format!("{:?}", info.listen_addrs), "listening_ addresses" => format!("{:?}", info.listen_addrs),
"Observed Address" => format!("{:?}", observed_addr), "observed_address" => format!("{:?}", observed_addr),
"Protocols" => format!("{:?}", info.protocols) "protocols" => format!("{:?}", info.protocols)
); );
} }
IdentifyEvent::Sent { .. } => {} IdentifyEvent::Sent { .. } => {}

View File

@@ -273,8 +273,6 @@ where
RPCEvent::Request(_, _) => self.send_request(rpc_event), RPCEvent::Request(_, _) => self.send_request(rpc_event),
RPCEvent::Response(rpc_id, response) => { RPCEvent::Response(rpc_id, response) => {
// check if the stream matching the response still exists // check if the stream matching the response still exists
trace!(self.log, "Checking for outbound stream");
// variables indicating if the response is an error response or a multi-part // variables indicating if the response is an error response or a multi-part
// response // response
let res_is_error = response.is_error(); let res_is_error = response.is_error();
@@ -284,7 +282,6 @@ where
Some((substream_state, _)) => { Some((substream_state, _)) => {
match std::mem::replace(substream_state, InboundSubstreamState::Poisoned) { match std::mem::replace(substream_state, InboundSubstreamState::Poisoned) {
InboundSubstreamState::ResponseIdle(substream) => { InboundSubstreamState::ResponseIdle(substream) => {
trace!(self.log, "Stream is idle, sending message"; "message" => format!("{}", response));
// close the stream if there is no response // close the stream if there is no response
if let RPCErrorResponse::StreamTermination(_) = response { if let RPCErrorResponse::StreamTermination(_) = response {
trace!(self.log, "Stream termination sent. Ending the stream"); trace!(self.log, "Stream termination sent. Ending the stream");
@@ -302,7 +299,6 @@ where
if res_is_multiple => if res_is_multiple =>
{ {
// the stream is in use, add the request to a pending queue // the stream is in use, add the request to a pending queue
trace!(self.log, "Adding message to queue"; "message" => format!("{}", response));
(*self (*self
.queued_outbound_items .queued_outbound_items
.entry(rpc_id) .entry(rpc_id)
@@ -386,7 +382,6 @@ where
.poll() .poll()
.map_err(|_| ProtocolsHandlerUpgrErr::Timer)? .map_err(|_| ProtocolsHandlerUpgrErr::Timer)?
{ {
trace!(self.log, "Closing expired inbound stream");
self.inbound_substreams.remove(stream_id.get_ref()); self.inbound_substreams.remove(stream_id.get_ref());
} }
@@ -396,7 +391,6 @@ where
.poll() .poll()
.map_err(|_| ProtocolsHandlerUpgrErr::Timer)? .map_err(|_| ProtocolsHandlerUpgrErr::Timer)?
{ {
trace!(self.log, "Closing expired outbound stream");
self.outbound_substreams.remove(stream_id.get_ref()); self.outbound_substreams.remove(stream_id.get_ref());
} }
@@ -420,7 +414,6 @@ where
match substream.poll() { match substream.poll() {
Ok(Async::Ready(raw_substream)) => { Ok(Async::Ready(raw_substream)) => {
// completed the send // completed the send
trace!(self.log, "RPC message sent");
// close the stream if required // close the stream if required
if closing { if closing {
@@ -428,7 +421,6 @@ where
InboundSubstreamState::Closing(raw_substream) InboundSubstreamState::Closing(raw_substream)
} else { } else {
// check for queued chunks and update the stream // check for queued chunks and update the stream
trace!(self.log, "Checking for queued items");
entry.get_mut().0 = apply_queued_responses( entry.get_mut().0 = apply_queued_responses(
raw_substream, raw_substream,
&mut self &mut self
@@ -456,7 +448,6 @@ where
}; };
} }
InboundSubstreamState::ResponseIdle(substream) => { InboundSubstreamState::ResponseIdle(substream) => {
trace!(self.log, "Idle stream searching queue");
entry.get_mut().0 = apply_queued_responses( entry.get_mut().0 = apply_queued_responses(
substream, substream,
&mut self.queued_outbound_items.get_mut(&request_id), &mut self.queued_outbound_items.get_mut(&request_id),
@@ -502,7 +493,6 @@ where
request, request,
} => match substream.poll() { } => match substream.poll() {
Ok(Async::Ready(Some(response))) => { Ok(Async::Ready(Some(response))) => {
trace!(self.log, "Message received"; "message" => format!("{}", response));
if request.multiple_responses() { if request.multiple_responses() {
entry.get_mut().0 = entry.get_mut().0 =
OutboundSubstreamState::RequestPendingResponse { OutboundSubstreamState::RequestPendingResponse {

View File

@@ -167,7 +167,7 @@ fn network_service(
match network_recv.poll() { match network_recv.poll() {
Ok(Async::Ready(Some(message))) => match message { Ok(Async::Ready(Some(message))) => match message {
NetworkMessage::RPC(peer_id, rpc_event) => { NetworkMessage::RPC(peer_id, rpc_event) => {
trace!(log, "Sending RPC"; "RPC" => format!("{}", rpc_event)); trace!(log, "Sending RPC"; "rpc" => format!("{}", rpc_event));
libp2p_service.lock().swarm.send_rpc(peer_id, rpc_event); libp2p_service.lock().swarm.send_rpc(peer_id, rpc_event);
} }
NetworkMessage::Propagate { NetworkMessage::Propagate {
@@ -236,7 +236,7 @@ fn network_service(
match libp2p_service.lock().poll() { match libp2p_service.lock().poll() {
Ok(Async::Ready(Some(event))) => match event { Ok(Async::Ready(Some(event))) => match event {
Libp2pEvent::RPC(peer_id, rpc_event) => { Libp2pEvent::RPC(peer_id, rpc_event) => {
trace!(log, "Received RPC"; "RPC" => format!("{}", rpc_event)); trace!(log, "Received RPC"; "rpc" => format!("{}", rpc_event));
// if we received or sent a Goodbye message, drop and ban the peer // if we received or sent a Goodbye message, drop and ban the peer
match rpc_event { match rpc_event {

View File

@@ -6,7 +6,7 @@ use beacon_chain::{
use eth2_libp2p::rpc::methods::*; use eth2_libp2p::rpc::methods::*;
use eth2_libp2p::rpc::{RPCEvent, RPCRequest, RPCResponse, RequestId}; use eth2_libp2p::rpc::{RPCEvent, RPCRequest, RPCResponse, RequestId};
use eth2_libp2p::PeerId; use eth2_libp2p::PeerId;
use slog::{debug, error, info, o, trace, warn}; use slog::{debug, info, o, trace, warn};
use ssz::Encode; use ssz::Encode;
use std::sync::Arc; use std::sync::Arc;
use store::Store; use store::Store;
@@ -475,13 +475,8 @@ impl<T: BeaconChainTypes> MessageProcessor<T> {
SHOULD_NOT_FORWARD_GOSSIP_BLOCK //TODO: Decide if we want to forward these SHOULD_NOT_FORWARD_GOSSIP_BLOCK //TODO: Decide if we want to forward these
} }
}, },
Err(e) => { Err(_) => {
error!( // error is logged during the processing therefore no error is logged here
self.log,
"Error processing gossip beacon block";
"error" => format!("{:?}", e),
"block slot" => block.slot
);
trace!( trace!(
self.log, self.log,
"Erroneous gossip beacon block ssz"; "Erroneous gossip beacon block ssz";
@@ -525,13 +520,13 @@ impl<T: BeaconChainTypes> MessageProcessor<T> {
self.network.disconnect(peer_id, GoodbyeReason::Fault); self.network.disconnect(peer_id, GoodbyeReason::Fault);
} }
}, },
Err(e) => { Err(_) => {
// error is logged during the processing therefore no error is logged here
trace!( trace!(
self.log, self.log,
"Erroneous gossip attestation ssz"; "Erroneous gossip attestation ssz";
"ssz" => format!("0x{}", hex::encode(msg.as_ssz_bytes())), "ssz" => format!("0x{}", hex::encode(msg.as_ssz_bytes())),
); );
error!(self.log, "Invalid gossip attestation"; "error" => format!("{:?}", e));
} }
} }
} }