| Crates.io | black |
| lib.rs | black |
| version | 0.0.2 |
| created_at | 2025-03-18 05:06:25.720039+00 |
| updated_at | 2025-03-19 00:21:27.936619+00 |
| description | A simple Black implementation in Rust for asynchronous, thread-safe logging. |
| homepage | https://github.com/brenogonzaga/black |
| repository | https://github.com/brenogonzaga/black |
| max_upload_size | |
| id | 1596140 |
| size | 16,026 |
Collecting workspace information
A simple logging library implemented in Rust.
The Black project is a simple logging library that allows you to record log messages at different levels (DEBUG, INFO, WARN, EVENT, and ERROR) to a file. Logging is performed asynchronously and in a thread-safe manner using Arc<Mutex<File>>.
Below is an example application that uses Black to record logs:
use anyhow::Result;
use black::BlackBox;
fn main() -> Result<()> {
let logger = BlackBox::new("blackbox.log")?;
logger.log_event("Application started")?;
logger.log_error("Error: could not connect to the database")?;
logger.log_event("Data processing complete")?;
Ok(())
}
To build the project, run:
cargo build
To run the example, execute:
cargo run --example main
To run the tests (if available), execute:
cargo test
Distributed under the MIT License.
Contributions are welcome! Please open an issue or submit a pull request.