Enable debug logging in application?
Hello everyone,
Im working on an application that I want to have the option to enable debug logging in realtime. Right now a log of message are written to the log while I test/develop things. Rather than leave all this logging on constantly I want to have it off by default and optionally turn it on. So far my thoughts are to have a module variable (or possibly several) each enable different debug options. Then in the code I could do something like: Code:
if (DEBUG_THIS_THING == true) { Is there a better way of doing this? Maybe a bitmask that would allow multiple logging levels for each component? |
Hi,
I'd be tempted to use existing libraries for this. You didn't say what language, but from your pseudo code it looks like it could be c++, so perhaps you could use boost. http://www.boost.org/doc/libs/1_56_0...tml/index.html HTH, Evo2. |
I have kept non-packaged libraries to a min in my application so far (I have one). The application is in C sorry I didn't mention that. Boost has some great capabilities though. I could possibly emulate some of those maybe?
Code:
int DEBUG_THIS_TRACE = 0; Code:
#define LOG_OFF 0 \\ Logging Level 0 |
All times are GMT -5. The time now is 09:48 PM. |