| Crates.io | librarius |
| lib.rs | librarius |
| version | 0.1.1 |
| created_at | 2025-04-14 04:39:54.589904+00 |
| updated_at | 2025-04-14 04:52:48.335738+00 |
| description | A simple and lightweight logging library for Rust. It provides a flexible framework for emitting log messages from Rust programs, with support for different log levels and output formats. |
| homepage | |
| repository | https://github.com/joaoprado-rs/librarius |
| max_upload_size | |
| id | 1632374 |
| size | 8,331 |
Librarius is a logging library in Rust that provides logging functionality for different severity levels, such as Info, Warn, Error, and Debug. The library allows logs to be sent to the terminal or a file, depending on the configuration. It is easy to integrate and configure within any Rust application.
Info, Warn, Error, Debug.info!, warn!, error!).Config struct.Add the following dependency to your Cargo.toml:
[dependencies]
librarius = "0.1"
use librarius::{Logger, Level, Config};
fn main() {
// Create the configuration
let config = Config::new(Level::Info);
// Initialize the logger
librarius::init(config);
// Using the log macros
info!("This is an info log");
warn!("This is a warning log");
error!("This is an error log");
debug!("This is a debug log");
}
use librarius::{Logger, Level, Config};
fn main() {
// Create the configuration
let config = Config::with_file(Level::Info, "logs.txt");
// Initialize the logger
librarius::init(config);
// Using the log macros
info!("This is an info log");
warn!("This is a warning log");
error!("This is an error log");
debug!("This is a debug log");
}
You can configure Librarius by creating a Config, where you define the log level and whether logs should be written to a file:
use librarius::{Config, Level};
let config = Config::with_file(Level::Info, "logs.txt");
This project is licensed under the MIT License - see the LICENSE file for details.