Expand description
logpeek
is a logger implementation for the log
crate, which focuses on reliability and simplicity.
It is meant to integrate seamlessly with logpeek-server.
It provides a Config
struct for configuring the logger.
The logger can be initialized with the init
function.
§Examples
use logpeek;
use log::error;
// See the documentation for the config module for more options
let config = logpeek::config::Config {
logging_mode: logpeek::config::LoggingMode::FileAndConsole,
datetime_format: logpeek::config::DateTimeFormat::Custom("[hour]:[minute]:[second]:[subsecond][offset_hour sign:mandatory]"), // Logpeek-server requires the UTC offset to be present.
target_filter: Some(vec!["logpeek::example_module"]), // No messages orginating from logpeek::example_module will be logged
..Default::default()
};
logpeek::init(config).unwrap(); // For the default config use logpeek::init(Default::default()).unwrap();
error!("This is a test error!");
Modules§
- Module containing the
Config
struct and its associated enums.
Functions§
- Initializes the logger by setting it as the global boxed logger for the
log
crate.