ezlog
- a simple, easy-to-configure, lightweight, action-based logger.
The ezlog
crate provides a simple logger. It does not provide any integration with the log
API.
The log request consists of an action, input data and output data. Nothing more.
A lot of things are hardcoded, so using this library as-is is not advised. Save it as your own crate.
Install
cargo add easy-log
Usage
The library has a Logger
type and a map![]
macro.
To build a logger, use the provided methods like this:
use ;
let default = new; // empty
let default2 = default; // same as the above
let default = default.ok; // nothing set => does nothing
let default = default.action.ok; // prints TEST: in green
let default = default.ok;
assert_eq!;
let test2 = "This is a test.";
assert_eq!;
// you can chain methods
default
.action
.input
.output // not only maps
.warn; // prints the action in yellow
default2
.action
.action // you can override the preferences set before
.err;
let really = true;
new
.action
.input
.output
.print; // set a custom color