Crates.io | s3logger |
lib.rs | s3logger |
version | 0.2.0 |
source | src |
created_at | 2022-10-27 18:27:26.833571 |
updated_at | 2022-10-28 18:53:15.744125 |
description | A simple logger that logs to S3 |
homepage | |
repository | https://github.com/multisig-labs/s3logger |
max_upload_size | |
id | 699517 |
size | 10,586 |
This is a super simple logging library for Rust that prints logs to console as well as uploads those logs to S3 as plain text.
use s3::creds::Credentials;
use s3::Region;
use s3logger::Logger;
use std::env;
fn main() {
let mut logger = Logger::new_blocking(
"my-bucket",
"my-logs.txt",
Region::UsEast1,
Credentials::from_env()::unwrap(),
);
logger.log("hello world!");
logger.log("This is some text");
logger.flush_blocking();
}
async fn main_async() {
let mut logger = Logger::new(
"my-bucket",
"my-logs.txt",
Region::UsEast1,
Credentials::from_env()::unwrap(),
).await;
logger.log("Async and sync both use 'log'");
logger.log("The only difference is the 'new' and 'flush' functions");
logger.flush().await;
}