Crates.io | rokkett-logger |
lib.rs | rokkett-logger |
version | 0.1.2 |
source | src |
created_at | 2022-10-27 20:20:11.634006 |
updated_at | 2022-10-28 11:35:09.713593 |
description | Utility for collecting logs from different applications. |
homepage | |
repository | https://gitlab.com/rokkett/rokkett-logger |
max_upload_size | |
id | 699718 |
size | 83,509 |
Lib containing the client and server for a centralized logging setup.
To use rokkett-logger, add it as a dependency to your Cargo.toml
.
$ cargo add rokkett-logger
To configure the logger, create a new RokkettLogger
which shall be initialized only once before any logs are generated.
#[tokio::main]
async fn main() {
// register logger
RokkettLogger::new("127.0.0.1:5500", "My App", Some("secret"))
.expect("failed to create logger");
// start logging :)
log::info!("Hello, world!");
}
See examples for more examples.
To use rokkett-logger, add it as a dependency to your Cargo.toml
.
$ cargo add rokkett-logger
#[tokio::main]
async fn main() {
let on_login = |token, _addr| token == "secret".to_string();
let on_log = |message, _addr| {
println!("{message}");
Status::Ok
};
Server::new(on_login, on_log).listen("127.0.0.1", 5500).await;
}
See examples for more examples.
Rokkett-Logger is distributed under the terms of the Apache-2.0 license.
Find an easy explanation on choosealicense.com/licenses/apache-2.0.