mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-13 01:51:23 +00:00
Remove all target
s from log statements. (#195)
The default uses crate + module path anyway, so `target` has been redundant, causes more work when renaming crates and makes log lines longer.
This commit is contained in:
@ -172,11 +172,11 @@ where
|
||||
let inner = self.inner;
|
||||
let future = substream.and_then(move |outbound| {
|
||||
if let Some(o) = outbound {
|
||||
debug!(target: "libp2p-core", "Using existing multiplexed connection to {}", addr);
|
||||
debug!("Using existing multiplexed connection to {}", addr);
|
||||
return Either::A(future::ok(o));
|
||||
}
|
||||
// The previous stream muxer did not yield a new substream => start new dial
|
||||
debug!(target: "libp2p-core", "No existing connection to {}; dialing", addr);
|
||||
debug!("No existing connection to {}; dialing", addr);
|
||||
match inner.dial(addr.clone()) {
|
||||
Ok(dial) => {
|
||||
let future = dial.and_then(move |(muxer, addr)| {
|
||||
@ -193,7 +193,7 @@ where
|
||||
));
|
||||
Ok((s, addr))
|
||||
} else {
|
||||
error!(target: "libp2p-core", "failed to dial to {}", addr);
|
||||
error!("failed to dial to {}", addr);
|
||||
shared.lock().active_connections.remove(&addr);
|
||||
Err(io::Error::new(io::ErrorKind::Other, "dial failed"))
|
||||
}
|
||||
@ -273,13 +273,13 @@ where
|
||||
}
|
||||
Ok(Async::NotReady) => {}
|
||||
Ok(Async::Ready(None)) => {
|
||||
debug!(target: "libp2p-core", "listener has been closed");
|
||||
debug!("listener has been closed");
|
||||
if self.connections.is_empty() && self.current_upgrades.is_empty() {
|
||||
return Ok(Async::Ready(None));
|
||||
}
|
||||
}
|
||||
Err(err) => {
|
||||
debug!(target: "libp2p-core", "error while polling listener: {:?}", err);
|
||||
debug!("error while polling listener: {:?}", err);
|
||||
if self.connections.is_empty() && self.current_upgrades.is_empty() {
|
||||
return Err(err);
|
||||
}
|
||||
@ -296,8 +296,7 @@ where
|
||||
}
|
||||
Err(err) => {
|
||||
// Insert the rest of the pending upgrades, but not the current one.
|
||||
debug!(target: "libp2p-core", "error while upgrading listener connection: \
|
||||
{:?}", err);
|
||||
debug!("error while upgrading listener connection: {:?}", err);
|
||||
return Ok(Async::Ready(Some(future::err(err))));
|
||||
}
|
||||
_ => {}
|
||||
@ -309,7 +308,7 @@ where
|
||||
match next_incoming.poll() {
|
||||
Ok(Async::Ready(None)) => {
|
||||
// stream muxer gave us a `None` => connection should be considered closed
|
||||
debug!(target: "libp2p-core", "no more inbound substreams on {}", client_addr);
|
||||
debug!("no more inbound substreams on {}", client_addr);
|
||||
self.shared.lock().active_connections.remove(&client_addr);
|
||||
}
|
||||
Ok(Async::Ready(Some(incoming))) => {
|
||||
@ -331,8 +330,7 @@ where
|
||||
self.connections.push((muxer, next_incoming, client_addr));
|
||||
}
|
||||
Err(err) => {
|
||||
debug!(target: "libp2p-core", "error while upgrading the \
|
||||
multiplexed incoming connection: {:?}", err);
|
||||
debug!("error while upgrading the multiplexed incoming connection: {:?}", err);
|
||||
// Insert the rest of the pending connections, but not the current one.
|
||||
return Ok(Async::Ready(Some(future::err(err))));
|
||||
}
|
||||
@ -384,13 +382,13 @@ where
|
||||
let (muxer, mut future, addr) = lock.next_incoming.swap_remove(n);
|
||||
match future.poll() {
|
||||
Ok(Async::Ready(None)) => {
|
||||
debug!(target: "libp2p-core", "no inbound substream for {}", addr);
|
||||
debug!("no inbound substream for {}", addr);
|
||||
lock.active_connections.remove(&addr);
|
||||
}
|
||||
Ok(Async::Ready(Some(value))) => {
|
||||
// A substream is ready ; push back the muxer for the next time this function
|
||||
// is called, then return.
|
||||
debug!(target: "libp2p-core", "New incoming substream");
|
||||
debug!("New incoming substream");
|
||||
let next = muxer.clone().inbound();
|
||||
lock.next_incoming.push((muxer, next, addr.clone()));
|
||||
return Ok(Async::Ready(future::ok((value, addr))));
|
||||
@ -400,9 +398,9 @@ where
|
||||
}
|
||||
Err(err) => {
|
||||
// In case of error, we just not push back the element, which drops it.
|
||||
debug!(target: "libp2p-core", "ConnectionReuse incoming: one of the \
|
||||
multiplexed substreams produced an error: {:?}",
|
||||
err);
|
||||
debug!("ConnectionReuse incoming: one of the \
|
||||
multiplexed substreams produced an error: {:?}",
|
||||
err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ where
|
||||
Du: Transport + 'static, // TODO: 'static :-/
|
||||
Du::Output: Into<T::Output>,
|
||||
{
|
||||
trace!(target: "libp2p-core", "Swarm dialing {}", multiaddr);
|
||||
trace!("Swarm dialing {}", multiaddr);
|
||||
|
||||
match transport.dial(multiaddr.clone()) {
|
||||
Ok(dial) => {
|
||||
@ -151,7 +151,7 @@ where
|
||||
Df: FnOnce(Du::Output, Multiaddr) -> Dfu + 'static, // TODO: 'static :-/
|
||||
Dfu: IntoFuture<Item = (), Error = IoError> + 'static, // TODO: 'static :-/
|
||||
{
|
||||
trace!(target: "libp2p-core", "Swarm dialing {} with custom handler", multiaddr);
|
||||
trace!("Swarm dialing {} with custom handler", multiaddr);
|
||||
|
||||
match transport.dial(multiaddr) {
|
||||
Ok(dial) => {
|
||||
@ -170,7 +170,7 @@ where
|
||||
pub fn listen_on(&self, multiaddr: Multiaddr) -> Result<Multiaddr, Multiaddr> {
|
||||
match self.transport.clone().listen_on(multiaddr) {
|
||||
Ok((listener, new_addr)) => {
|
||||
trace!(target: "libp2p-core", "Swarm listening on {}", new_addr);
|
||||
trace!("Swarm listening on {}", new_addr);
|
||||
// Ignoring errors if the receiver has been closed, because in that situation
|
||||
// nothing is going to be processed anyway.
|
||||
let _ = self.new_listeners.unbounded_send(listener);
|
||||
@ -224,15 +224,13 @@ where
|
||||
|
||||
match self.next_incoming.poll() {
|
||||
Ok(Async::Ready(connec)) => {
|
||||
debug!(target: "libp2p-core", "Swarm received new multiplexed \
|
||||
incoming connection");
|
||||
debug!("Swarm received new multiplexed incoming connection");
|
||||
self.next_incoming = self.transport.clone().next_incoming();
|
||||
self.listeners_upgrade.push(Box::new(connec) as Box<_>);
|
||||
}
|
||||
Ok(Async::NotReady) => {}
|
||||
Err(err) => {
|
||||
debug!(target: "libp2p-core", "Error in multiplexed incoming \
|
||||
connection: {:?}", err);
|
||||
debug!("Error in multiplexed incoming connection: {:?}", err);
|
||||
self.next_incoming = self.transport.clone().next_incoming();
|
||||
}
|
||||
};
|
||||
@ -272,12 +270,12 @@ where
|
||||
|
||||
match self.listeners.poll() {
|
||||
Ok(Async::Ready(Some((Some(upgrade), remaining)))) => {
|
||||
trace!(target: "libp2p-core", "Swarm received new connection on listener socket");
|
||||
trace!("Swarm received new connection on listener socket");
|
||||
self.listeners_upgrade.push(upgrade);
|
||||
self.listeners.push(remaining.into_future());
|
||||
}
|
||||
Err((err, _)) => {
|
||||
warn!(target: "libp2p-core", "Error in listener: {:?}", err);
|
||||
warn!("Error in listener: {:?}", err);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
@ -293,7 +291,7 @@ where
|
||||
));
|
||||
}
|
||||
Err(err) => {
|
||||
warn!(target: "libp2p-core", "Error in listener upgrade: {:?}", err);
|
||||
warn!("Error in listener upgrade: {:?}", err);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
@ -305,17 +303,17 @@ where
|
||||
.push(future::Either::A(handler(output, addr).into_future()));
|
||||
}
|
||||
Err(err) => {
|
||||
warn!(target: "libp2p-core", "Error in dialer upgrade: {:?}", err);
|
||||
warn!("Error in dialer upgrade: {:?}", err);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
match self.to_process.poll() {
|
||||
Ok(Async::Ready(Some(()))) => {
|
||||
trace!(target: "libp2p-core", "Future returned by swarm handler driven to completion");
|
||||
trace!("Future returned by swarm handler driven to completion");
|
||||
}
|
||||
Err(err) => {
|
||||
warn!(target: "libp2p-core", "Error in processing: {:?}", err);
|
||||
warn!("Error in processing: {:?}", err);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ where
|
||||
.protocol_names()
|
||||
.map::<_, fn(_) -> _>(|(n, t)| (n, <Bytes as PartialEq>::eq, t));
|
||||
let remote_addr2 = remote_addr.clone();
|
||||
debug!(target: "libp2p-core", "Starting protocol negotiation");
|
||||
debug!("Starting protocol negotiation");
|
||||
|
||||
let negotiation = match endpoint {
|
||||
Endpoint::Listener => multistream_select::listener_select_proto(connection, iter),
|
||||
@ -56,10 +56,8 @@ where
|
||||
.map_err(|err| IoError::new(IoErrorKind::Other, err))
|
||||
.then(move |negotiated| {
|
||||
match negotiated {
|
||||
Ok(_) => debug!(target: "libp2p-core", "Successfully negotiated \
|
||||
protocol upgrade with {}", remote_addr2),
|
||||
Err(ref err) => debug!(target: "libp2p-core", "Error while negotiated \
|
||||
protocol upgrade: {:?}", err),
|
||||
Ok(_) => debug!("Successfully negotiated protocol upgrade with {}", remote_addr2),
|
||||
Err(ref err) => debug!("Error while negotiated protocol upgrade: {:?}", err),
|
||||
};
|
||||
negotiated
|
||||
})
|
||||
@ -70,9 +68,8 @@ where
|
||||
.into_future()
|
||||
.then(|val| {
|
||||
match val {
|
||||
Ok(_) => debug!(target: "libp2p-core", "Successfully applied negotiated \
|
||||
protocol"),
|
||||
Err(_) => debug!(target: "libp2p-core", "Failed to apply negotiated protocol"),
|
||||
Ok(_) => debug!("Successfully applied negotiated protocol"),
|
||||
Err(_) => debug!("Failed to apply negotiated protocol"),
|
||||
}
|
||||
val
|
||||
});
|
||||
|
Reference in New Issue
Block a user