Remove all targets 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:
Toralf Wittner
2018-05-17 15:14:13 +02:00
committed by GitHub
parent cb800624f5
commit 86a21fc43e
22 changed files with 158 additions and 217 deletions

View File

@ -243,7 +243,7 @@ fn read_stream_internal<T: AsyncRead, Buf: Array<Item = u8>>(
substream_id,
packet_type,
} = MultiplexHeader::parse(header).map_err(|err| {
debug!(target: "libp2p-mplex", "failed to parse header: {}", err);
debug!("failed to parse header: {}", err);
io::Error::new(
io::ErrorKind::Other,
format!("Error parsing header: {:?}", err),
@ -282,10 +282,10 @@ fn read_stream_internal<T: AsyncRead, Buf: Array<Item = u8>>(
}
Err(error) => {
return if let varint::Error(varint::ErrorKind::Io(inner), ..) = error {
debug!(target: "libp2p-mplex", "failed to read header: {}", inner);
debug!("failed to read header: {}", inner);
Err(inner)
} else {
debug!(target: "libp2p-mplex", "failed to read header: {}", error);
debug!("failed to read header: {}", error);
Err(io::Error::new(io::ErrorKind::Other, error.description()))
};
}
@ -298,10 +298,7 @@ fn read_stream_internal<T: AsyncRead, Buf: Array<Item = u8>>(
use self::NextMultiplexState::*;
let body_len = varint_state.read(&mut lock.stream).map_err(|e| {
debug!(target: "libp2p-mplex",
"substream {}: failed to read body length: {}",
next.substream_id(),
e);
debug!("substream {}: failed to read body length: {}", next.substream_id(), e);
io::Error::new(io::ErrorKind::Other, "Error reading varint")
})?;
@ -401,8 +398,7 @@ fn read_stream_internal<T: AsyncRead, Buf: Array<Item = u8>>(
return on_block;
}
Err(other) => {
debug!(target: "libp2p-mplex",
"substream {}: failed to read new stream: {}",
debug!("substream {}: failed to read new stream: {}",
substream_id,
other);
lock.read_state = Some(NewStream {
@ -469,8 +465,7 @@ fn read_stream_internal<T: AsyncRead, Buf: Array<Item = u8>>(
return on_block;
}
Err(other) => {
debug!(target: "libp2p-mplex",
"substream {}: failed to read message body: {}",
debug!("substream {}: failed to read message body: {}",
substream_id,
other);
return Err(other);
@ -520,8 +515,7 @@ fn read_stream_internal<T: AsyncRead, Buf: Array<Item = u8>>(
return on_block;
}
Err(other) => {
debug!(target: "libp2p-mplex",
"substream {}: failed to read ignore bytes: {}",
debug!("substream {}: failed to read ignore bytes: {}",
substream_id,
other);
lock.read_state = Some(Ignore {

View File

@ -98,7 +98,7 @@ impl<T, Buf: Array> MultiplexShared<T, Buf> {
}
pub fn open_stream(&mut self, id: u32) -> bool {
trace!(target: "libp2p-mplex", "open stream {}", id);
trace!("open stream {}", id);
self.open_streams
.entry(id)
.or_insert(SubstreamMetadata::new_open())
@ -106,7 +106,7 @@ impl<T, Buf: Array> MultiplexShared<T, Buf> {
}
pub fn close_stream(&mut self, id: u32) {
trace!(target: "libp2p-mplex", "close stream {}", id);
trace!("close stream {}", id);
self.open_streams.insert(id, SubstreamMetadata::Closed);
}

View File

@ -207,10 +207,7 @@ pub fn write_stream<Buf: circular_buffer::Array, T: AsyncWrite>(
Err(Some(Body { size }))
}
Err(other) => {
debug!(target: "libp2p-mplex",
"substream {}: failed to write body: {}",
id,
other);
debug!("substream {}: failed to write body: {}", id, other);
return Err(other);
}
}