Hi,
I wrote a new crate called log-derive
that contains a proc-macro
to easily log the result of functions even if they return Result and contain multiple ?
operators.
Would love to hear feedback on usability, code and documentation
https://crates.io/crates/log-derive
The usage is very simple:
#[logfn(Err = "Error", fmt = "Failed Sending Packet: {:?}")]
fn send_hi(addr: SocketAddr) -> Result<(), io::Error> {
let mut stream = TcpStream::connect(addr)?;
stream.write(b"Hi!")?;
Ok( () )
}
#[logfn(Trace)]
fn test_log(a: u8) -> String {
(a*2).to_string()
}