#error-logging #log-messages #debugging-logging #bug #message #info #debug-info

scorched

A simple logging library for scorching all those pesky bugs

18 unstable releases (3 breaking)

0.5.3 May 14, 2024
0.5.2 Feb 22, 2024
0.5.1 Jan 8, 2024
0.4.5 Dec 14, 2023
0.2.3 Jun 24, 2023

#499 in Debugging

Download history 1/week @ 2024-08-20 2/week @ 2024-08-27 1/week @ 2024-09-10 5/week @ 2024-09-17 34/week @ 2024-09-24 19/week @ 2024-10-01 4/week @ 2024-10-08

1,493 downloads per month
Used in obg-bonk

Apache-2.0

10KB
205 lines

Scorched

A simple logging library for scorching all those pesky bugs.

[!NOTE] The current minimum supported Rust version is: 1.60.0 (Last checked on 1/3/2023)

Example

This example shows how to use log_this to log a message and check optional values.

use scorched::*;

let something = Some(5);
let nothing = None::<i32>;

something.log_except(LogImportance::Error, "This should not be logged");
nothing.log_except(LogImportance::Error, "This should be logged");

log_this(LogData {
    LogImportance::Debug,
    "All of the tests have now finished!"
});

You can also use the log_except method on Option to log a message if the value is None.

use scorched::*;

let bad_value = None::<i32>;

bad_value.log_except(LogImportance::Error, "This should be logged");

[!TIP] If you like you can use the logf! macro to log a message and format a string without explicitly needing to run the format macro.

let thread_id = "7"
logf!(Info, "Heartbeat from thread {}.", thread_id);

Dependencies

~1MB
~18K SLoC