Expand description
§A versatile and extensible logging implementation
§Usage
Add the dependencies to your Cargo.toml
with:
cargo add log
cargo add logforth
Here, log
is the logging facade and logforth
is the logging implementation.
Then, you can use the logger with:
use log::LevelFilter;
use logforth::append;
use logforth::layout::TextLayout;
use logforth::Dispatch;
use logforth::Logger;
Logger::new()
.dispatch(
Dispatch::new()
.filter(LevelFilter::Trace)
.layout(TextLayout::default())
.append(append::Stdout),
)
.apply()
.unwrap();
log::error!("Hello error!");
log::warn!("Hello warn!");
log::info!("Hello info!");
log::debug!("Hello debug!");
log::trace!("Hello trace!");
Read more demos under the examples directory.
Re-exports§
Modules§
- Dispatch log records to the appropriate target.
- Determinate whether a log record should be processed.
- Describe how to format a log record.
Structs§
- A grouped set of appenders, filters, and optional layout.
- A logger facade that dispatches log records to one or more
Dispatch
instances.