#if DEBUG_LEVEL < 1
#define INFO tellp();//
#define MOREINFO tellp();//
#elif DEBUG_LEVEL < 2
#define INFO
#define MOREINFO tellp();//
#elif DEBUG_LEVEL >= 2
#define INFO
#define MOREINFO
#endif
With your current code, this will work depending on whether debug level is 0 (no debugging), 1 (low debugging) or 2 (high debugging). Though, this must be defined at compile time, to use command line arguments you'd have to have the appropriate main() definition.
That actually wouldn't work because of the pesky dot operator:
cout.INFO <<
Will evaluate to the below if INFO is an empty define:
cout. << which of course is nonsense because of the dot
also, comments are not part of macros, so you can't remove the rest of the line like that.
The question is, do you want this log level to be determined at compile time or run time? From your original post I thought you were looking for runtime, but L B thought compile time.
You can define main like this: int main(unsignedint ArgCount, char* const Args[])
(note you can rename ArgCount and Args to whatever you want)
Then, when someone starts your program with the command line -debug or /debug, you can loop through Args as an array of char* and check with strcmp if it matches "debug". If none of the parameters do, then you're not in debug mode.