#tracing #init #derive #debugging #file-io #debug-mode

macro quick_tracing_derive

A simple library to easily start tracing.(derive)

5 releases

0.1.4 Jun 2, 2024
0.1.3 Jun 2, 2024
0.1.2 Jun 2, 2024
0.1.1 Jun 2, 2024
0.1.0 Jun 2, 2024

#31 in #debug-mode

Download history 2/week @ 2024-08-30 31/week @ 2024-09-06 54/week @ 2024-09-13 44/week @ 2024-09-20 20/week @ 2024-09-27 24/week @ 2024-10-04 3/week @ 2024-10-11 17/week @ 2024-10-18 58/week @ 2024-10-25 19/week @ 2024-11-01 86/week @ 2024-11-08 59/week @ 2024-11-15 20/week @ 2024-11-22 101/week @ 2024-11-29 155/week @ 2024-12-06 88/week @ 2024-12-13

366 downloads per month
Used in quick_tracing

MIT license

9KB
129 lines

Quick Tracing derive

This is derive. See quick_tracing

Need to write the following it in Cargo.toml

quick_tracing = { version = "0.1.4", features = ["derive"] }

Attributes

  • test: Sets the test name for the logger. Log output will be written to a file named ../../logs/{test_name}.log.
  • file: Sets the file path for the log output.
  • stdio: Enables standard I/O output for the logger.(default: true)
  • level: Sets the log level filter (e.g., TRACE, DEBUG, INFO, WARN, ERROR).

Examples

#[quick_tracing::init]
fn main() {
    tracing::debug!("Hello, world!");
}
  • Debug mode + Output file

    If there is no parent directory, it will automatically create one.

[!WARNING] Panic is a possibility.

#[quick_tracing::init(level= "DEBUG", file = "./log/test.log", stdio = false)]
fn main() {
    tracing::debug!("Hello, world!");
}

lib.rs:

Initializing a multithreaded logger in Rust.(Derive)

This library provides functionality to initialize a multithreaded logger with flexible configuration options. It supports both file I/O logging and logging to stdout with ANSI color support.

Dependencies

~3MB
~64K SLoC