A
Angus
I want to setup a macro to log informational strings if eg
INFOLOGGING
is defined. So I created a macro which outputs informational strings
to a log file.
I want to have a #define which switches this option on or off.
My problem is that I need to do a load of string processing to build
up the informational string. Then the informational string is passed
to the macro. Now if the define is not set then the macro never gets
called. That is fine. But ideally I don't want all this string
processing if the define is not set.
Is my only way round this to have loads of #ifdef <whatever>'s? It
just looks a bit dirty. But I can't see any way round it?
I am trying to implement detailed logging. Errors are always logged
but I want a #define to switch on a higher level of logging.
Anyone got any bright ideas on how to handle this?
INFOLOGGING
is defined. So I created a macro which outputs informational strings
to a log file.
I want to have a #define which switches this option on or off.
My problem is that I need to do a load of string processing to build
up the informational string. Then the informational string is passed
to the macro. Now if the define is not set then the macro never gets
called. That is fine. But ideally I don't want all this string
processing if the define is not set.
Is my only way round this to have loads of #ifdef <whatever>'s? It
just looks a bit dirty. But I can't see any way round it?
I am trying to implement detailed logging. Errors are always logged
but I want a #define to switch on a higher level of logging.
Anyone got any bright ideas on how to handle this?