Clean up logging

This commit is contained in:
Olivier 'reivilibre' 2021-07-09 21:12:48 +01:00
parent d0934e12a8
commit 0d50247e5c
5 changed files with 4 additions and 15 deletions

View File

@ -74,13 +74,13 @@ pub fn chunking<R: Read + Send + 'static, W: Write + Send + 'static, RP: RawPile
raw_pile, raw_pile,
); );
info!("JH"); info!("Waiting for remote to finish.");
for handle in join_handles { for handle in join_handles {
handle.join().expect("Join handle should not fail"); handle.join().expect("Join handle should not fail");
} }
info!("J!"); info!("Remote finished.");
Ok(()) Ok(())
} }

View File

@ -107,11 +107,10 @@ pub fn chunking_stdio(path: &PathBuf) -> anyhow::Result<()> {
requester_join_handles requester_join_handles
}; };
info!("Waiting to join DBG."); info!("Waiting to join.");
for join_handle in requester_join_handles { for join_handle in requester_join_handles {
join_handle.join().expect("Expected to join handle"); join_handle.join().expect("Expected to join handle");
info!("handle");
} }
info!("Chunking completed."); info!("Chunking completed.");

View File

@ -22,8 +22,6 @@ use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
use serde::de::DeserializeOwned; use serde::de::DeserializeOwned;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use log::debug;
use crate::pile::Keyspace; use crate::pile::Keyspace;
pub mod requester; pub mod requester;
@ -85,7 +83,6 @@ pub enum ResponseBody {
pub fn read_message<R: Read, D: DeserializeOwned>(read: &mut R) -> anyhow::Result<D> { pub fn read_message<R: Read, D: DeserializeOwned>(read: &mut R) -> anyhow::Result<D> {
let len = read.read_u32::<BigEndian>()?; let len = read.read_u32::<BigEndian>()?;
debug!("RM {:?}", len);
let mut data_vec = vec![0u8; len as usize]; let mut data_vec = vec![0u8; len as usize];
read.read_exact(&mut data_vec)?; read.read_exact(&mut data_vec)?;
Ok(serde_bare::from_slice(&data_vec)?) Ok(serde_bare::from_slice(&data_vec)?)
@ -93,9 +90,7 @@ pub fn read_message<R: Read, D: DeserializeOwned>(read: &mut R) -> anyhow::Resul
pub fn write_message<W: Write, S: Serialize>(write: &mut W, message: &S) -> anyhow::Result<()> { pub fn write_message<W: Write, S: Serialize>(write: &mut W, message: &S) -> anyhow::Result<()> {
let data_vec = serde_bare::to_vec(&message)?; let data_vec = serde_bare::to_vec(&message)?;
debug!("WM {:?}", data_vec.len());
write.write_u32::<BigEndian>(data_vec.len().try_into()?)?; write.write_u32::<BigEndian>(data_vec.len().try_into()?)?;
write.write_all(&data_vec)?; write.write_all(&data_vec)?;
write.flush()?;
Ok(()) Ok(())
} }

View File

@ -193,7 +193,6 @@ impl Requester {
/// Helper to make a request and wait for the result. /// Helper to make a request and wait for the result.
fn request(&self, req: RequestBody) -> anyhow::Result<ResponseBody> { fn request(&self, req: RequestBody) -> anyhow::Result<ResponseBody> {
info!("Req...");
let (sender, receiver) = crossbeam_channel::bounded(0); let (sender, receiver) = crossbeam_channel::bounded(0);
self.commands self.commands
.send((req, sender)) .send((req, sender))
@ -207,7 +206,6 @@ impl Requester {
impl RawPile for Requester { impl RawPile for Requester {
fn exists(&self, kind: Keyspace, key: &[u8]) -> anyhow::Result<bool> { fn exists(&self, kind: Keyspace, key: &[u8]) -> anyhow::Result<bool> {
info!("Ex?");
match self.request(RequestBody::CheckExists { match self.request(RequestBody::CheckExists {
kind, kind,
key: key.to_vec(), key: key.to_vec(),
@ -232,7 +230,6 @@ impl RawPile for Requester {
} }
} }
fn write(&self, kind: Keyspace, key: &[u8], value: &[u8]) -> anyhow::Result<()> { fn write(&self, kind: Keyspace, key: &[u8], value: &[u8]) -> anyhow::Result<()> {
info!("Wr?");
match self.request(RequestBody::Write { match self.request(RequestBody::Write {
kind, kind,
key: key.to_vec(), key: key.to_vec(),

View File

@ -7,8 +7,7 @@ use std::thread::JoinHandle;
use anyhow::anyhow; use anyhow::anyhow;
use crossbeam_channel::{Receiver, Sender}; use crossbeam_channel::{Receiver, Sender};
use itertools::Itertools; use itertools::Itertools;
use log::error; use log::{error, warn};
use log::{info, warn};
use crate::pile::RawPile; use crate::pile::RawPile;
use crate::remote::{read_message, write_message, Request, RequestBody, Response, ResponseBody}; use crate::remote::{read_message, write_message, Request, RequestBody, Response, ResponseBody};
@ -79,7 +78,6 @@ impl Responder {
) -> anyhow::Result<()> { ) -> anyhow::Result<()> {
loop { loop {
let request: Request = read_message(&mut read)?; let request: Request = read_message(&mut read)?;
info!("M!<");
match request.body { match request.body {
RequestBody::NextBatch { token } => { RequestBody::NextBatch { token } => {