log-rs

Crates.iolog-rs
lib.rslog-rs
version0.1.1
sourcesrc
created_at2020-04-07 16:33:07.541823
updated_at2020-04-08 14:29:52.606716
descriptionA small logging library.
homepage
repositoryhttps://github.com/guilhemSmith/log-rs
max_upload_size
id227324
size13,234
(guilhemSmith)

documentation

README

log-rs

A small logging library.
Can log on 4 level: INFO, DEBUG, WARNING, and ERROR.
Each level can be configured to write to a specific output.

Example

let mut log = Logger::new().unwrap();
log.config_format("[%l|%t]: %m");

log.config_info(OutputKind::STDOUT);
log.config_debug(OutputKind::STDERR);
log.config_warning(OutputKind::FILE("errlog.txt"));
log.config_error(OutputKind::FILE("errlog.txt"));

log.info("informations.");
log.warning("my warning.");
log.debug("more informations.");
log.error("an error.");

Display of sdtout:

[INFO|2020-04-07T15:42:31+0000]: informations.

Display of sdterr:

[DEBUG|2020-04-07T15:42:31+0000]: more informations.

Content of errlog.txt:

[WARNING|2020-04-07T15:42:31+0000]: my warning.
[ERROR|2020-04-07T15:42:31+0000]: an error.
Commit count: 15

cargo fmt