loggerv
A simple stdout and stderr writing Logger implementation of the log crate, using ansi_term for colors and configured via a log level. Designed for simple Command Line Interfaces (CLIs).
Usage
First, add this to your Cargo.toml:
[]
= "0.4"
= "0.7"
Next, add this to the main.rs or the file containing the main function for your CLI program:
extern crate loggerv;
Getting Started
Clone this repository, then run the following commands to see the log level change:
This will run an example that uses the clap argument parser to change the log level at run-time based on the number of -v arguments that are passed to the application. As the occurrence of the -v argument increases, the number of log statements that are displayed should increase.
Next, run the following commands:
This will run an example that changes the output from defaults at compile-time. The following commands will demonstration configuration at run-time:
Similar to the quick example, as the occurrence of the -v argument increases, the number of log statements that are displayed should increase. As the various configuration arguments, i.e. -l, -d, etc. are added, the format of the log statements change. The -h,--help flag can be used to display information about the various flags and their effects on logging and output.
Finally, run the following commands to demonstration build profile configuration:
The number of log statements are displayed based on the build profile, either Debug or Release.
Documentation
License
MIT-Licensed. See LICENSE file for details.