#debugging #formatted #console #prints #test

pretty_debug

Simple crate for module based formatted console prints

5 releases

0.1.4 Aug 10, 2022
0.1.3 Aug 10, 2022
0.1.2 Aug 10, 2022
0.1.1 Aug 10, 2022
0.1.0 Aug 10, 2022

#16 in #prints

MIT license

5KB

Pretty Debug

Pretty Debug adds a Debugger trait which simply allows you to print to the console with user defined module tags.

This crate is fine to use though I doubt will ever be needed due to severe lack of functionality but is intended as a test to publish to crates.io

Intended Usage

Simply define an enum implementing the Debugger trait as following:

enum Debug {
    Module,
}

impl Debugger for Debug {
    fn display(&self) -> String {
        match self {
            Debug::Module => "[From Module]",
        }
        .to_string()
    }
}

Note: the return of the display function are used as a prefix.

Then call the debug method on the desired variant of your enum:

Debug::Module.debug("This was sent from the Module module")

Additional Notes

You may refer to the provided example for additional ergonomics.

I expect this crate to only be in use by me, though feel free to make any requests through github with additional features or changes.

I may add some other smaller features in the future if desired for my projects, such as a suffix and default function definitions later.

No runtime deps