Crates.io | log-rs |
lib.rs | log-rs |
version | 0.1.1 |
source | src |
created_at | 2020-04-07 16:33:07.541823 |
updated_at | 2020-04-08 14:29:52.606716 |
description | A small logging library. |
homepage | |
repository | https://github.com/guilhemSmith/log-rs |
max_upload_size | |
id | 227324 |
size | 13,234 |
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.
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.