1 unstable release
0.2.0 | Aug 22, 2021 |
---|
#14 in #panics
Used in notification-server
18KB
400 lines
bin_common
A library for common things in binaries. Mainly useful for a quick logging setup with support for logging to files, logging panics and log rotation.
Usage
This is an example for how to use this library.
let crate_setup = CrateSetupBuilder::new()
.with_app_name("my-cool-app") // set app name for paths
.build()
.unwrap();
crate_setup
.logging_setup()
.with_verbosity(1) // log only INFO and above messages
.with_log_to_file(true) // write all log messages to file and stdout
.with_log_panics(true) // log panics
.with_log_rotation(true) // rotate log files
.build()
.unwrap();
log::info("{} starting", crate_setup.application_name());
The CrateSetup
stores the application name and resulting base directories according to the XDG directory spec and allows setting up logging.
Dependencies
~1.5–9.5MB
~82K SLoC