RustWatchman is a Rust library that provides a logging implementation for writing logs to Amazon CloudWatch. It uses the AWS SDK for Rust to implement the CloudWatch logging functionality.
- Install Rust and Cargo.
- Clone the repository.
- Run
cargo build --release
to build the project. - Run
cargo test
to run the unit tests.
To use RustWatchman in your Rust project, add the follohttps://docs.rs/tracing/latest/tracing/wing to your Cargo.toml
file:
[dependencies]
rust_watchman = { git = "https://github.com/prabhat0206/RustWatchman.git" }
Then, in your Rust code, import the Watchman struct from the rust_watchman crate:
use rust_watchman::Watchman;
You can then create a new instance of the Watchman struct and use it to write logs to CloudWatch:
#[tokio::main]
async fn main() {
let sdk_config = aws_config::load_from_env().await;
let writer = Watchman::new(sdk_config, "test".to_string(), "new".to_string()).await.get_writer();
tracing_subscriber::fmt()
.with_max_level(tracing::Level::INFO)
.with_target(false)
.with_writer(writer)
.init();
tracing::info!("Hello, world!");
}
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
This project is still in development and is not ready for production use. Use at your own risk.