Crates.io | log_lib |
lib.rs | log_lib |
version | 0.1.0 |
source | src |
created_at | 2023-11-23 01:02:21.837507 |
updated_at | 2023-11-23 01:02:21.837507 |
description | A simple logging library. |
homepage | https://github.com/tylercritchlow/memoir |
repository | https://github.com/tylercritchlow/memoir |
max_upload_size | |
id | 1045680 |
size | 10,633 |
Memoir is a powerful and flexible logging library for Rust that makes it easy to capture, record, and analyze events in your code. With its intuitive interface and rich features, Memoir is the ideal tool for developers who want to gain deeper insights into their applications.
You can use the package manager cargo
to install memoir.
cargo install memoir
or add it to your current project by also using cargo
to install memoir.
cargo add memoir
We provide a simple interface for memoir, to help users access a logging system as easily as possible. We provide simple functions to output each type of log level.
use memoir::*; // Import everything needed from memoir.
fn main() {
let mut f: FileLogger = FileLogger { // Initialize our FileLogger, and make sure it is mut.
filepath: "current_log.log".to_string(),
whitelist: vec![LogLevel::Warning], // Filter what Logs you want to see.
format: "[%d] %l - %m".to_string(), // Format of the outputted log.
};
f.warn("test".to_string()); // Output a warning log onto the filepath, if in whitelist.
f.set_format("%d::%l - %m") // Sets a new format.
}
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.