Skip to content

Logging functionalities with different levels and rotation options built on top of tracing written in 🦀

License

Notifications You must be signed in to change notification settings

stefanodecillis/speak-easy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Speak Easy — Logging functionalities

License Crates.io Version

Speak-Easy

Speak-Easy is a Rust library that provides logging functionalities with different levels and rotation options built on top of tracing and compatible with tokio-rs.

Features

  • Different log levels
  • Log rotation options
  • Cleanup functionality

Usage

First, add the following to your Cargo.toml:

[dependencies]
speak-easy = { version = "0.1" }
tokio = { features = ["macros", "rt-multi-thread"], version = "1.37.0" }

Note

If you want to use Speak-Easy without tokio, you must disable default features:

[dependencies]
speak-easy = { version = "0.1", default-features = false }

Then, use the library in your code like this:

use speak_easy::speak_easy::SpeakEasy;
use speak_easy::{info, Level};
use speak_easy::{Rotation, SpeakConfig};

#[tokio::main]
async fn main() {
    let speak_config = SpeakConfig::new(
        Rotation::Minutely,
        "./logs".to_string(),
        "my_log".to_string(),
    )
    .with_cleanup(24 * 60 * 60, 5);

    SpeakEasy::init(Level::INFO, Some(speak_config));

    info!("this is a log");
}

Please replace "/path/to/log/files" with the actual path where you want to store your log files.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Feel free to open issues and send PRs. We will evaluate them together in the comment section.

About

Logging functionalities with different levels and rotation options built on top of tracing written in 🦀

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages