https://github.com/axnjr/unilog_rs
A lightweight Rust logging library supporting async/sync logging, log file handling, log levels and colored logs.
https://github.com/axnjr/unilog_rs
cargo crates-io lib library lightweight logging rust tool
Last synced: 5 months ago
JSON representation
A lightweight Rust logging library supporting async/sync logging, log file handling, log levels and colored logs.
- Host: GitHub
- URL: https://github.com/axnjr/unilog_rs
- Owner: Axnjr
- Created: 2025-02-08T11:20:05.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-02-17T12:36:09.000Z (over 1 year ago)
- Last Synced: 2025-09-23T16:43:54.850Z (9 months ago)
- Topics: cargo, crates-io, lib, library, lightweight, logging, rust, tool
- Language: Rust
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# `🦀unilog.rs`
[](https://crates.io/crates/unilog)
[](https://docs.rs/unilog)
## Example
```rust
use unilog::{Level, UniLog, Fatal, Error, Warn, Notice, Info, Debug, Trace};
fn main() {
let instance = UniLog::init()
.set_log_file_name("server.log") // dont forget the file extension
.log_to_terminal(true)
.async_logging()
.enable_timestamping()
.enable_colored_logs()
.max_log_file_size(20) // 20 Mb, would truncate the log file if its size exceeds this limit!
;
Fatal! (instance, "TRIAL of fatal error via macros !!");
Notice!(instance, "TRIAL of notices lets see what happens !!");
Warn! (instance, "TRIAL of warnings lets see what happens !!");
Info! (instance, "TRIAL of information lets see what happens !!");
Debug! (instance, "TRIAL of debugging lets see what happens !!");
Error! (instance, "TRIAL of error lets see what happens !!");
Trace! (instance, "TRIAL of tracing lets see what happens !!");
}
```
# Sample logs
```py
[Feb 08 16:38:33] | [NOTICE] : TRIAL of notoices lets see what happens !!
[Feb 08 16:38:33] | [WARNN ] : TRIAL of warnings lets see whta happens !!
[Feb 08 16:38:33] | [ERROR ] : TRIAL of error lets see what hap !!
[Feb 08 16:38:33] | [TRACE ] : TRIAL of tracing lets see what hap !!
[Feb 08 16:44:05] | [FATAL ] : Trial for Fatal error via macros !!
[Feb 08 16:46:04] | [FATAL ] : Trial for Fatal error via macros !!
[Feb 08 16:46:04] | [NOTICE] : TRIAL of notices lets see what happens !!
[Feb 08 16:46:04] | [WARNN ] : TRIAL of warnings lets see what happens !!
[Feb 08 16:46:04] | [INFO ] : TRIAL of information lets see what happens !!
[Feb 08 16:46:04] | [DEBUG ] : TRIAL of debugging lets see what happens !!
[Feb 08 16:46:04] | [ERROR ] : TRIAL of error lets see what happens !!
[Feb 08 16:46:04] | [TRACE ] : TRIAL of tracing lets see what happens !!
```