hddsuperclone
hddsuperclone copied to clipboard
Proposal: rewrite logging
The codebase uses quite a large number of print statements:
Some of these statements use the built-in translation system and should not be touched at this time:
But thousands of them are debugging statements not intended to be translated:
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:
Since this will be one of the larger code changes, I wanted to get some feedback before I start submitting pull requests.
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.