Crates.io | soulog |
lib.rs | soulog |
version | 1.2.2 |
source | src |
created_at | 2023-08-18 09:45:06.180096 |
updated_at | 2024-08-11 14:59:29.266064 |
description | A library for polished, clean and colourful console logging and error handling. |
homepage | |
repository | https://github.com/GreenChild04/soulog |
max_upload_size | |
id | 947725 |
size | 28,530 |
A library for polished, clean and colourful console logging and error handling.
Some utils for printing to the console in colour.
use soulog::*;
// The macro is pretty simple, it's just a list of strings and you have to surround each string with a colour (in lowercase)
// If you don't want a colour, then use `none` for the default colour of the console.
let colourful_text = colour_format![blue("["), none("Example"), blue("] "), none("Here is an example body!")];
println!("{}", colourful_text); // Prints the colourful text to screen
soulog::sbl::PanicLogger
which panics on errorsFor when you want to log an event or just to give an update to the user through the console
use soulog::*;
pub fn process(mut logger: impl Logger) {
// First part is the logger surrounded by parenthesis, this is the destination the log is going to
// The second part is the origin of the log, the function is called `process` so it should be `Process`
// The third part is the log body, it should be formatted like in a `format!()` macro
log!((logger) Process("Example log of a number: {}", 12));
// You can also have error-like logs such as inconvenience logs
log!((logger.error) Process("Example inconvenience log") as Inconvenience);
}