Crates.io | scorched |
lib.rs | scorched |
version | 0.5.3 |
source | src |
created_at | 2023-06-23 22:49:21.062294 |
updated_at | 2024-05-14 01:57:08.953568 |
description | A simple logging library for scorching all those pesky bugs. |
homepage | |
repository | |
max_upload_size | |
id | 898654 |
size | 10,506 |
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)
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);