hddsuperclone icon indicating copy to clipboard operation
hddsuperclone copied to clipboard

Proposal: rewrite logging

Open SomeCrazyGuy opened this issue 8 months ago • 1 comments

The codebase uses quite a large number of print statements:

Image

Some of these statements use the built-in translation system and should not be touched at this time:

Image

But thousands of them are debugging statements not intended to be translated:

Image

Ususally these statements take up 4 lines of code to print and sync the output, but do not provide the best debugging experience, I could refactor all these debugging statements to call a macro that automatically includes date/time, filename, function name, line number, and fflush the output.

I propose starting a set of patches that add a utility header and c file to move common operations (starting with logging) to one central location that could be used anywhere in the codebase. The proposed util.h header should be something like this:

Image

Since this will be one of the larger code changes, I wanted to get some feedback before I start submitting pull requests.

SomeCrazyGuy avatar Mar 10 '25 14:03 SomeCrazyGuy

This proposal makes sense to me, yes, reducing the lines and having a proper logging infrastructure is a good idea. Just make sure we don't add any log4j like parsing of the code that causes code execution vulnerabilities.

thesourcerer8 avatar Mar 10 '25 16:03 thesourcerer8