rokkett-logger

Crates.iorokkett-logger
lib.rsrokkett-logger
version0.1.2
sourcesrc
created_at2022-10-27 20:20:11.634006
updated_at2022-10-28 11:35:09.713593
descriptionUtility for collecting logs from different applications.
homepage
repositoryhttps://gitlab.com/rokkett/rokkett-logger
max_upload_size
id699718
size83,509
(ch-sch-rokkett)

documentation

README

Rokkett Logger

Status Coverage

Lib containing the client and server for a centralized logging setup.

Client implementation

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.

Server implementation

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.

License

Rokkett-Logger is distributed under the terms of the Apache-2.0 license.
Find an easy explanation on choosealicense.com/licenses/apache-2.0.

Commit count: 34

cargo fmt