Then, those source files use fprintf to do basic error logging. This is suboptimal, because the error messages have to include the full context of the source code that they come from explicitly to be useful as debug messages. They are also uncolored, and have no filterable severity (info, debug, warning, error, message).
There are four simple steps to improving the logging now:
copying these logging files into the mdo-core source tree (include/log.h and src/log.c)
replacing and removing every TODO note and associated #include <stdio.h> statement
adding #include "log.h instead
replacing all fprintf calls used for debug logging with LOG_* macros
If you have any questions, such as regarding which severity each debug message should be made as you come across them, ask in this issue and I'll answer them.
In almost every source file right now, there are TODOs right at the top that look something like this:
Then, those source files use
fprintf
to do basic error logging. This is suboptimal, because the error messages have to include the full context of the source code that they come from explicitly to be useful as debug messages. They are also uncolored, and have no filterable severity (info, debug, warning, error, message).I've already written logging functionality to solve these problems in the
mdo-utils
repository: https://github.com/mondradiko/mdo-utils/blob/main/include/log.h https://github.com/mondradiko/mdo-utils/blob/main/src/log.cThere are four simple steps to improving the logging now:
mdo-core
source tree (include/log.h
andsrc/log.c
)#include <stdio.h>
statement#include "log.h
insteadfprintf
calls used for debug logging withLOG_*
macrosIf you have any questions, such as regarding which severity each debug message should be made as you come across them, ask in this issue and I'll answer them.