fnlog

crates.io

Logging with function names.

Example

``` use fnlog::{fndebug, fnerror, fninfo, fntrace, fn_warn};

fn hello() { fntrace!("trace in hello"); fndebug!("debug in hello"); fninfo!("info in hello"); fnwarn!("warn in hello"); fn_error!("error in hello"); }

fn main() { envlogger::init(); fntrace!("trace in main"); fndebug!("debug in main"); fninfo!("info in main"); fnwarn!("warn in main"); fnerror!("error in main"); hello(); } ```

Assumes the binary is main:

$ RUST_LOG=trace ./main [2020-11-23T21:13:44Z TRACE main] [main::main] trace in main [2020-11-23T21:13:44Z DEBUG main] [main::main] debug in main [2020-11-23T21:13:44Z INFO main] [main::main] info in main [2020-11-23T21:13:44Z WARN main] [main::main] warn in main [2020-11-23T21:13:44Z ERROR main] [main::main] error in main [2020-11-23T21:13:44Z TRACE main] [main::hello] trace in hello [2020-11-23T21:13:44Z DEBUG main] [main::hello] debug in hello [2020-11-23T21:13:44Z INFO main] [main::hello] info in hello [2020-11-23T21:13:44Z WARN main] [main::hello] warn in hello [2020-11-23T21:13:44Z ERROR main] [main::hello] error in hello