Skip to content

Debug/trace logging improvements#2832

Merged
johnnovak merged 8 commits intomainfrom
jn/debug-logging-improvements
Sep 6, 2023
Merged

Debug/trace logging improvements#2832
johnnovak merged 8 commits intomainfrom
jn/debug-logging-improvements

Conversation

@johnnovak
Copy link
Copy Markdown
Member

@johnnovak johnnovak commented Sep 5, 2023

When it comes to debugging, I'm very much an old-school printf trace logger type of person (Who needs 'em stinkin' debuggers? Not this guy! 😎)

So I've been prefixing my LOG_MSG statements with stuff like to >>>>>>>> and !!!!!!!!! and ******* to make them stand out from the rest, then started repurposing LOG_ERR and LOG_WARNING because the coloured output makes my debug/trace messages stand out even more.

Then today it dawned on me: I can actually make LOG_DEBUG output stuff in a different colour with loguru! I've also seen the light and realised that @weirddan455 was right all along—module-specific DEBUG_MODULNAME ifdefs are the way to go. So I started converting a few modules to that convention as well.

Here's how it looks in action with mixer.cpp and vga_draw.cpp debug logging enabled. As you can see, my VGA and mixer debug crap doesn't get drowned in the rest of the crap anymore. Crap stands out, loud and clear—it doesn't get better than that! 😎 🤘🏻

...except when it does! 😆 I've also added LOG_TRACE for good measure which uses a nice purple colour .

image

@johnnovak johnnovak force-pushed the jn/debug-logging-improvements branch from 1853740 to 5b6932b Compare September 5, 2023 05:49
@johnnovak johnnovak requested review from kcgen and weirddan455 and removed request for kcgen September 5, 2023 07:41
Comment thread include/logging.h Outdated
@johnnovak johnnovak marked this pull request as ready for review September 5, 2023 07:45
@johnnovak johnnovak force-pushed the jn/debug-logging-improvements branch from 1a1d4d0 to 75fa71d Compare September 5, 2023 07:53
@johnnovak johnnovak self-assigned this Sep 6, 2023
@johnnovak johnnovak added the plumbing Issues related to low-level support functions and classes label Sep 6, 2023
@johnnovak johnnovak force-pushed the jn/debug-logging-improvements branch from 75fa71d to a6ca874 Compare September 6, 2023 03:46
@johnnovak johnnovak force-pushed the jn/debug-logging-improvements branch from a6ca874 to d36bb34 Compare September 6, 2023 07:48
@johnnovak
Copy link
Copy Markdown
Member Author

johnnovak commented Sep 6, 2023

Done @kcgen , let me know if there's a better way to disable the warning in meson.build.

Copy link
Copy Markdown
Member

@kcgen kcgen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good; nice to see more loguru benefits being put to use!

@johnnovak johnnovak merged commit 1f5c33d into main Sep 6, 2023
@kcgen kcgen deleted the jn/debug-logging-improvements branch October 14, 2023 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plumbing Issues related to low-level support functions and classes

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants