# rf_logger Implements a logger that can log to stdout/stderr and rotated files ## Usage ### In libraries `rf_logger` makes sense when used in executables (binary projects). Libraries should use the [`log`](https://docs.rs/log) crate instead. ### In executables It must be added along with `log` to the project dependencies: ```toml [dependencies] log = "0.4.0" chrono = "0.4.31" rf_logger = "0.2.0" ``` `rf_logger` must be initialized as early as possible in the project. After it's initialized, you can use the `log` macros to do actual logging. ## Formatting Time formatting string can be set via `Builder::time_fmt()` while other parts are fixed. ```rust let _ = writeln!( buf, "{} - {} - {}", now.format(&self.time_fmt), record.level(), record.args() ); ``` ## Examples ```rust use log::{LevelFilter, info}; use rf_logger; rf_logger::Builder::new() .max_level(LevelFilter::Debug) .stdout() .rotated_file("tests/demo.log", 5 * 1024, 3) .init(); ``` ## Notes There is a mutex lock during every log record beening handled, if performance is what your concern this crate may not be a good choice.