more logging

This commit is contained in:
Alex 2020-12-04 14:06:06 +01:00
parent b63179c699
commit 0b041c77f4
3 changed files with 13 additions and 5 deletions

View file

@ -53,8 +53,9 @@ async fn main() {
.parse_env("RUST_LOG") .parse_env("RUST_LOG")
.format(|buf, record| { .format(|buf, record| {
writeln!(buf, writeln!(buf,
"{} {} {}", "{} {} {} {}",
chrono::Local::now().format("%s%.6f"), chrono::Local::now().format("%s%.6f"),
record.module_path().unwrap_or("_"),
record.level(), record.level(),
record.args() record.args()
) )

View file

@ -32,8 +32,9 @@ async fn main() {
.parse_env("RUST_LOG") .parse_env("RUST_LOG")
.format(|buf, record| { .format(|buf, record| {
writeln!(buf, writeln!(buf,
"{} {} {}", "{} {} {} {}",
chrono::Local::now().format("%s%.6f"), chrono::Local::now().format("%s%.6f"),
record.module_path().unwrap_or("_"),
record.level(), record.level(),
record.args() record.args()
) )

View file

@ -339,6 +339,7 @@ impl Basalt {
{ {
Ok(resp) => { Ok(resp) => {
self.handle_peer_list(&resp.peers[..]); self.handle_peer_list(&resp.peers[..]);
info!("KYEV PEXi {}", hex::encode(peer));
} }
Err(e) => { Err(e) => {
warn!("Error during pull exchange: {}", e); warn!("Error during pull exchange: {}", e);
@ -348,10 +349,15 @@ impl Basalt {
async fn do_push(self: Arc<Self>, peer: ed25519::PublicKey) { async fn do_push(self: Arc<Self>, peer: ed25519::PublicKey) {
let push_msg = self.make_push_message(); let push_msg = self.make_push_message();
if let Err(e) = self.netapp.request(&peer, push_msg, PRIO_NORMAL).await { match self.netapp.request(&peer, push_msg, PRIO_NORMAL).await {
Ok(_) => {
info!("KYEV PEXo {}", hex::encode(peer));
}
Err(e) => {
warn!("Error during push exchange: {}", e); warn!("Error during push exchange: {}", e);
} }
} }
}
fn make_push_message(&self) -> PushMessage { fn make_push_message(&self) -> PushMessage {
let current_peers = self.view.read().unwrap().current_peers_vec(); let current_peers = self.view.read().unwrap().current_peers_vec();
@ -424,7 +430,7 @@ impl Basalt {
if is_incoming { if is_incoming {
self.handle_peer_list(&[Peer { id: pk, addr }][..]); self.handle_peer_list(&[Peer { id: pk, addr }][..]);
} else { } else {
info!("KYEV C {}", hex::encode(pk)); info!("KYEV C {} {}", hex::encode(pk), addr);
let peer = Peer { id: pk, addr }; let peer = Peer { id: pk, addr };
let mut backlog = self.backlog.write().unwrap(); let mut backlog = self.backlog.write().unwrap();