Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Less verbose console output #4029

Merged
merged 1 commit into from
Nov 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions core/network/src/discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ use libp2p::multiaddr::Protocol;
use log::{debug, info, trace, warn};
use std::{cmp, collections::VecDeque, time::Duration};
use tokio_io::{AsyncRead, AsyncWrite};
use primitives::hexdisplay::HexDisplay;

/// Implementation of `NetworkBehaviour` that discovers the nodes on the network.
pub struct DiscoveryBehaviour<TSubstream> {
Expand Down Expand Up @@ -316,16 +317,16 @@ where
KademliaEvent::GetClosestPeersResult(res) => {
match res {
Err(GetClosestPeersError::Timeout { key, peers }) => {
warn!(target: "sub-libp2p",
"Libp2p => Query for {:?} timed out with {:?} results",
key, peers.len());
debug!(target: "sub-libp2p",
"Libp2p => Query for {:?} timed out with {} results",
HexDisplay::from(&key), peers.len());
},
Ok(ok) => {
trace!(target: "sub-libp2p",
"Libp2p => Query for {:?} yielded {:?} results",
ok.key, ok.peers.len());
HexDisplay::from(&ok.key), ok.peers.len());
if ok.peers.is_empty() && self.num_connections != 0 {
warn!(target: "sub-libp2p", "Libp2p => Random Kademlia query has yielded empty \
debug!(target: "sub-libp2p", "Libp2p => Random Kademlia query has yielded empty \
results");
}
}
Expand Down
6 changes: 3 additions & 3 deletions core/sr-io/with_std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,17 +180,17 @@ impl OtherApi for () {
}

fn print_num(val: u64) {
println!("{}", val);
log::debug!(target: "runtime", "{}", val);
}

fn print_utf8(utf8: &[u8]) {
if let Ok(data) = std::str::from_utf8(utf8) {
println!("{}", data)
log::debug!(target: "runtime", "{}", data)
}
}

fn print_hex(data: &[u8]) {
println!("{}", HexDisplay::from(&data));
log::debug!(target: "runtime", "{}", HexDisplay::from(&data));
}

fn log(
Expand Down