| Crates.io | fancy-log |
| lib.rs | fancy-log |
| version | 0.1.1 |
| created_at | 2025-08-14 08:00:48.094305+00 |
| updated_at | 2025-09-03 12:33:51.25051+00 |
| description | A fancy logging library with colorized output and structured logs. |
| homepage | https://github.com/canmi21/fancy-log |
| repository | https://github.com/canmi21/fancy-log |
| max_upload_size | |
| id | 1794595 |
| size | 19,221 |
A simple and customizable logging library for Rust, providing colored console output with timestamped log messages and configurable log levels.
Error, Warn, Info, and Debug log levels.HH:MM:SS format.Add the following to your Cargo.toml:
[dependencies]
fancy-log = "0.1.0"
use fancy_log::{log, set_log_level, LogLevel};
fn main() {
// Set the minimum log level to Info
set_log_level(LogLevel::Info);
// Log messages
log(LogLevel::Info, "This is an info message");
log(LogLevel::Warn, "This is a warning message");
log(LogLevel::Error, "This is an error message");
log(LogLevel::Debug, "This debug message will not be shown");
}
You can configure the log level to filter out messages below a certain threshold:
use fancy_log::{set_log_level, LogLevel};
// Set log level to Debug to show all messages
set_log_level(LogLevel::Debug);
stderr in red.stderr in yellow.stdout in white.stdout in blue.Example output:
12:34:56 This is an info message
12:34:56 This is a warning message
12:34:56 This is an error message
chrono = "0.4": For timestamp formatting.once_cell = "1.21": For thread-safe global log level storage.termcolor = "1.4.1": For colored console output.serde = { version = "1", features = ["derive"] }: For log level deserialization.This project is licensed under the MIT License. See the LICENSE file for details.