dzl

A library for logging. It is simple and easy to use. It is also lightweight and has a few dependencies :)

Usage

  1. Add this library as a dependency to your Cargo.toml.
  2. src/main.rs: ```rust use dzl::Config;

fn main() { // not write logs to files // let dzlconfig = Config::new(false, "dzl.log".tostring());

// use default config
let dzl_config = Config::default_config();
// initializing
dzl::init(&dzl_config);

// logging, you can also use `format!()` macro to format the string
dzl_config.trace("dzl".to_string());
dzl_config.info("dzl".to_string());
dzl_config.warn("dzl".to_string());
dzl_config.error("dzl".to_string());
// custom log type
dzl_config.custom("CustomType".to_string(), "dzl".to_string());

} `` 3. The logs will print tostdoutorstderr*(only forerrorlogger)*. If the fieldwritelogstofilesin structConfigis false, logs will not write to the log file, they will only print tostdoutorstderr. The default logging path isdzl.log, you can change it with change the fieldlogpathin the structConfigby use functionnew()` with arguments.

You should make sure that the dictionary of log_path exists. The library will only create file dzl.log

e.g. log_path: "dzl/dzl.log".to_string(), the logs will write to file dzl/dzl.log. 😀