I've got the following function and I'd like to have warnings as one has when using printf:
void LoggingManager::log(int32_t logLevel, const char *p_str, ...)
{
va_list args;
va_start(args, p_str);
vsnprintf(s_LogginManagerBuffer, LOGGING_MANAGER_BUFFER_SIZE - 1, p_str, args);
va_end(args);
internalLog(s_LogginManagerBuffer);
}
I'd like to somehow have warnings if I forget to add an argument for one of the tokens in the format-string. Also warnings for having too many (or wrong arguments) would be awesome. I recently faced some crashes due to forgetting an argument in the logging function.
If it's not possible to do it this way, how could I rewrite my function, to have warnings but the same functionality?