Open arthuraraujo-msft opened 8 months ago
Did some testing:
LOG_INFO(handler, "%d", string_arg);
I got
warning C4477: 'printf' : format string '%d' requires an argument of type 'int', but variadic argument 1 has type 'const char *'
For
LOG_INFO(handler, "%s %d", string_arg);
warning C4473: 'printf' : not enough arguments passed for format string
Suggestion by @shishirb-MSFT:
We can add a "(void)(0 && printf(format, __VA_ARGS__))" as the first line of the logging macros.
The expression is short-circuited by '0 &&' such that no runtime call is made. It will also do a compile-time check of the arguments.