Crate sensible_env_logger
source · [−]Expand description
A pretty, sensible logger for Rust.
Usage
Even though it has env in the name, the sensible-env-logger
requires zero configuration and setup to use:
use log::*;
fn main() {
sensible_env_logger::init();
trace!("a trace example");
debug!("deboogging");
info!("such information");
warn!("o_O");
error!("boom");
}Defaults
The defaults can be setup by calling init() or try_init() at the start
of the program.
Examples
You can check out sample usage of this crate in the examples/ folder in the project repo on GitHub.
Readme Docs
You can find the crate’s readme documentation on the
crates.io page, or alternatively in the README.md file on the GitHub project repo.
Enable logging
This crate uses pretty_env_logger and env_logger internally, so the same ways of enabling logs through an environment variable are supported.
The sensible_env_logger crate re-exports these crates, through the
pretty and env namespaces respectively.
Re-exports
pub use pretty_env_logger as pretty;pub use pretty_env_logger::env_logger as env;Functions
Returns a formatted builder which adds local time to log messages.
Initializes the global logger with a pretty, sensible env logger.
Initializes the global logger with a timed pretty, sensible env logger.
Initializes the global logger with an “abbreviated” timed pretty, sensible env logger.
Initializes the global logger with a pretty, sensible env logger.
Initialized the global logger with a pretty, sensible env logger, with custom variable names and a custom builder function.
Initializes the global logger with a timed pretty, sensible env logger.
Initializes the global logger with an “abbreviated” timed pretty, sensible env logger.