3 unstable releases

0.2.0 Oct 28, 2022
0.1.1 Oct 27, 2022
0.1.0 Oct 27, 2022

#623 in Debugging

Download history 33/week @ 2024-02-22 19/week @ 2024-02-29 5/week @ 2024-03-07

57 downloads per month

MIT license

10KB
196 lines

S3Logger for Rust

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.

Example

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;
}

Dependencies

~8–11MB
~225K SLoC