bin_common

Crates.iobin_common
lib.rsbin_common
version0.2.0
sourcesrc
created_at2021-08-22 18:57:23.989673
updated_at2021-08-22 18:57:23.989673
descriptionA library for common things in binaries.
homepage
repositoryhttps://gitlab.com/999eagle/rust_bin_common
max_upload_size
id440811
size18,986
Sophie Tauchert (999eagle)

documentation

README

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.

Commit count: 7

cargo fmt