#logging #log #trace #info #logging-library

dzl

A crate for logging. It is simple and easy to use :)

5 releases

0.2.1 Dec 11, 2022
0.2.0 Dec 3, 2022
0.1.2 Oct 3, 2022
0.1.1 Oct 1, 2022
0.1.0 Oct 1, 2022

#873 in Debugging

MPL-2.0 license

13KB
255 lines

dzl

A crate for logging.

It is simple and easy to use

You can learn more here

Example

main.rs

dzl::init().ok(); // Call this function only once in main.rs
dzl::loggers::trace("Something...");
dzl::loggers::debug("Something...");
dzl::loggers::info("Something...");
dzl::loggers::warn("Something...");
dzl::loggers::error("Something...");
dzl::loggers::custom("CustomType", "Something...");

Dzl.toml

write_to_log_file = true
log_path = "dzl.log" # This file needs to be created
log_level = "debug" # Only logs greater than or equal to this level will be printed and written to the log file

Output:

2022-12-03 11:30:55.23172315 +08:00:00 DEBUG Something...
2022-12-03 11:30:55.233852405 +08:00:00 WARN Something...
2022-12-03 11:30:55.235884013 +08:00:00 ERROR Something...
2022-12-03 11:30:55.240158709 +08:00:00 CustomType Something...

TODO

  • WASM (Console API) (0.3)
  • Better Error Handling

Dependencies

~1.2–8.5MB
~76K SLoC