When you make a program or programs, you need to check the program running condition.
In this reason, you want to use the debug message into the program.In the debugging time you use the print put the logging messages and in the release time you don't want to use the logging messages.
When you use the macro "#define" how can you convert printf(char* format, ...) function to macro function?
As following,
// Multiple arguments
#define MSG_ERR(format, ...) TRACE(ERROR, format, __VA_ARGS__)
#define MSG_WARN(format, ...) TRACE(WARNING, format, __VA_ARGS__)
#define MSG_HIGH(format, ...) TRACE(HIGH, format, __VA_ARGS__)
#define MSG_MID(format, ...) TRACE(MIDDLE, format, __VA_ARGS__)
#define MSG_LOW(format, ...) TRACE(LOW, format, __VA_ARGS__)
// Single argument
#define MSG_ERR(format) TRACE(ERROR, format)
#define MSG_WARN(format) TRACE(WARNING, format)
#define MSG_HIGH(format) TRACE(HIGH, format)
#define MSG_MID(format) TRACE(MIDDLE, format)
#define MSG_LOW(format) TRACE(LOW, format)
And get more things, please refer to
Support for variadic macros was introduced in Visual C++ 2005.
No comments:
Post a Comment