Crates.io | aether-log |
lib.rs | aether-log |
version | 0.1.1 |
source | src |
created_at | 2022-06-26 11:43:45.109313 |
updated_at | 2022-06-26 11:59:44.383419 |
description | Minimal logging library that uses explicit and configurable endpoints. |
homepage | |
repository | https://github.com/nobbele/aether-log |
max_upload_size | |
id | 613514 |
size | 26,683 |
Minimal logging library for Rust that uses explicit and configurable endpoints.
It supports automatic archiving of old files if using the archive
feature, otherwise it adds a .bk
extension.
use aether::log;
#[derive(Debug, Hash)]
enum Endpoint {
Foo,
Bar,
Baz,
}
fn main() {
let _keep = aether::init()
.format(|log| {
format!(
"{} [{:?}] {}",
log.time.format("%T.%3f"),
log.endpoint,
log.text
)
})
.base_path("logs")
.setup(Endpoint::Foo, |ep| ep.no_path())
.setup(Endpoint::Bar, |ep| ep.path("output.log"))
.setup(Endpoint::Baz, |ep| ep.path("baz.log").silent())
.build();
log!(Endpoint::Foo, "Hello World! {}", 0);
log!(Endpoint::Baz, "I'm in the world!");
log!(Endpoint::Bar, "Goodbye World! {}", 1);
}