uRustLogger
uRustLogger is a lightweight, flexible, and fully-featured logging library for Rust, designed for both console and file output. It supports multiple log levels, colored console output, file logging with optional icons, per-module tagging, and a rich set of macros for all common data types. The library is ideal for applications that need structured logging with minimal setup.
Features
-
Multiple log levels:
Verbose,Debug,Info,Warning,Error,Fatal,Fixed -
Console output with colors: Each log level can be shown in a distinct color for easy readability.
-
File logging: Logs can be written to a timestamped file. Optionally, each log level can include Unicode emoji icons instead of plain text.
-
Module support: Each log message can include a module tag to indicate the source of the log. Use the macro
log_module!("MODULE_NAME");at the top of your Rust file to set the module name for all subsequent logs from that file.
Note: Module names are limited to 8 characters to ensure proper alignment in log output. -
Configurable formatting:
- Include/exclude timestamps
- Enable/disable console colors
- Use icons or plain text in log files
- Include module tags in log output
-
Rich macro-based API:
log_print!– log multiple values at once- Type-specific macros for all Rust primitive types:
- Strings:
log_str! - Integers:
log_i8!,log_i16!,log_i32!,log_i64! - Unsigned:
log_u8!,log_u16!,log_u32!,log_u64! - Floats:
log_f32!,log_f64! - Booleans:
log_bool! - Characters:
log_char! - Hex:
log_hex8!,log_hex16!,log_hex32!,log_hex64! - Pointers:
log_ptr!
- Strings:
-
Global thread-safe logger using
Arc<Mutex<Logger>> -
Initialization macros:
log_init!to configure the logger andlog_deinit!to safely shut it down. -
Per-file module tagging: Use
log_module!("MODULE_NAME");to assign a module name for all log statements in a file. This module name will appear in both console and file output next to the log level, making it easier to trace the origin of messages.
Note: Only the first 8 characters of the module name are used for alignment.
Quick Setup
use *;
Testing
Run cargo run --example basic_test
Screenshot console output

Screenshot file output (with icons)
![]()
Screenshot file output (plain text)
