A console to live debug your C code

  • Board Nominations
    Nominations have now closed and the results are available here.
  • Hey Guest, MARCHintosh 2026 is upon us. Check out community projects, join GlobalTalk, and have fun!

ftech

New Tinkerer
Mar 31, 2025
19
22
3
I have updated the logger.c lib, that I made last year, to implement a graphical console that pops up in your C app so that you can quickly log and see any data from your application.

It is fairly lightweight (just a logger.c and logger.h files) that you add to your project. You can get those files from its AmendHub project: https://amendhub.com/ftech/Logger
(You can ignore the `logger-test.c` file from this project as it won't run without its resource file. It is just my test app for making the console as shown in the screenshots.)

To use use console, you need to initialize the logger with CONSOLE_OUT as a parameter (the logger can also log to a file with FILE_OUT):
C:
InitLogger(DEBUG_LEVEL, CONSOLE_OUT,  NULL);

You also need to make sure that you forward your apps events to the logger and ignore those that are intercepted by the console window.
Add the following at the top of your events handler function:
C:
if(logger.onEvent(event)) {
    return;
}

Finally, make sure that `#define USE_LOGGER`is not commented and tweak the settings at the top of the "logger.h" file.

Now, the console should appear if you log somthing:
C:
logger.debug("My value is %d", myValue);

Let me know if you have any comment or if you need any help with using the console.

Picture_1.jpg



Picture_3.jpg