5 unstable releases

0.3.2 Mar 24, 2023
0.3.1 Mar 10, 2023
0.3.0 Mar 10, 2023
0.2.0 Mar 10, 2023
0.1.1 Mar 10, 2023

#1363 in Game dev

30 downloads per month

Custom license

19KB
499 lines

Logtra

Publish Version Lint, Build and Test

logtra is a logging library for Rust.

Features

  • Sinks
    • Register a sink
    • Unregister a sink
  • Log
    • Formatting
      • timestamp
      • current ThreadId
      • module
      • severity
      • name of sink
      • file
      • line
      • color
      • message
    • Macro
      • Different Log Intensities
      • Expressions/Evaluations
      • Asserts
        • Evaluating asserts (assert)
        • Conditional logs (cassert)
        • Panicking asserts (passert)

Usage

logtra is almost entirely macro based.

Example

fn main() {
    sink!(
        ConsoleSink::new(
            SinkDeclaration {
                name: "console".to_string(),
                severity: LogSeverity::Trace,
                module: "".to_string(),
                template: "[%t][%c][%[%i%]][%s][%f:%l]: %m\n".to_string(),
            }
        )
    )

    trace!("Hello World: Trace!");
    debug!("Hello World: Debug!");
    info!("Hello World: Info!");
    warn!("Hello World: Warn!");
    error!("Hello World: Error!");
    fatal!("Hello World: Fatal!");
    log!(Info, &obj);
}

Dependencies

~3MB
~57K SLoC