easyloggingpp
easyloggingpp copied to clipboard
easylogging++ disable DEBUG preprocessing flag
The preprocessing flag DEBUG is commonly used for many codebases. Usually, people seeking to debug use -DDEBUG in the compiler flags to activate debugging. However, if you are using easylogging++, you will have some weird behavior because easylogging++ disables (more appropriately, undefine) DEBUG (see here).
One way to circumvent this is to use the following piece at the beginning of your file:
#ifdef DEBUG
#define DEBUG_BY_PASS_EASYLOGGING
#endif
#include "third_part/easylogging++/easylogging++.h"
// Restore the DEBUG status.
#ifdef DEBUG_BY_PASS_EASYLOGGING
#define DEBUG
#endif
This works fine, but it is a little bit inconvenient because you must do it on all files that include easylogging++.
Is that a reason we need to disable the flag DEBUG? Can you do it in another way?
Thanks