Crate woodpecker [−] [src]
Woodpecker - fast and extensible logger for Rust
The main goal of woodpecker
is to be incredibly fast for the code
that doesn't generate the log.
Please check out the project homepage for more details on features, issues and limitation.
The log levels are assigned in a hierarchical manner.
If there's no exact match for a requested log then the closest match is used.
That means that the log level for foo::bar::qux
is deduced from the log level
for foo::bar
unless the log level for foo::bar::qux
is explicitly set.
See documentation for the [wp_get_level
][wp_get_level] and [log
][log] macros for more details on the hierarchy.
[wp_get_level]: macro.wp_get_level.html
[log]: macro.log.html
Installation
To start using woodpecker
it's enough to just enable it in your Cargo.toml
:
[dependencies]
woodpecker = "0.1"
In your main.rs
:
#[macro_use] extern crate woodpecker; use woodpecker as wp; fn main() { wp::init(); warn!("It's alive!"); }
And start using logging functions as debug
, info
, etc. as with
generic rust logger
Example
#[macro_use] extern crate woodpecker; use woodpecker as wp; fn main() { wp::init(); wp_set_level!(wp::LogLevel::INFO); info!("{} is saying hello", "woodpecker"); debug!("I'm invisible"); }
Modules
formatters |
Collection of log record formatters. |
handlers |
Collection of log handlers. |
levels |
Definition of the log levels. |
logger |
The logger core. |
record |
Definition of the log record entry. |
Macros
critical |
Produces log record for the |
debug |
Produces log record for the |
error |
Produces log record for the |
info |
Produces log record for the |
log |
The main log entry. |
notice |
Produces log record for the |
trace |
Produces log record for the |
verbose |
Produces log for the |
warn |
Produces log record for the |
wp_get_level |
Gets the log level. |
wp_register_handler |
Registers a log record handler. |
wp_separator |
A file-module separator. |
wp_set_formatter |
Sets a log record formatter. |
wp_set_level |
Sets the log level. |
Functions
init |
Initializes the crate's kitchen. |