in src/etwlogger_driver.c [204:261]
void etwlogger_log(LOG_CATEGORY log_category, const char* file, const char* func, int line, unsigned int options, const char* format, ...)
{
(void)options;
lazyRegisterEventProvider();
va_list args;
va_start(args, format);
char message[LOG_SIZE_REGULAR * (LOG_SIZE_REGULAR >= sizeof(vsnprintf_failure_message))]; /*this construct will generate a compile time error (array of size 0) when LOG_SIZE_REGULAR is not enough to hold even the failure message*/
{/*scope for constructing the user (format,...)*/
int vsnprintf_result;
vsnprintf_result = vsnprintf(message, sizeof(message), format, args);
if (
(vsnprintf_result < 0) ||
(vsnprintf_result >= (int)sizeof(message))
)
{
(void)memcpy(message, vsnprintf_failure_message, sizeof(vsnprintf_failure_message));
}
else
{
/*all fine, message now contains user message*/
}
}
switch (log_category)
{
case AZ_LOG_CRITICAL:
{
perform_EventWriteLogCriticalEvent(message, file, func, line);
break;
}
case AZ_LOG_ERROR:
{
perform_EventWriteLogErrorEvent(message, file, func, line);
break;
}
case AZ_LOG_WARNING:
{
perform_EventWriteLogWarningEvent(message, file, func, line);
break;
}
case AZ_LOG_INFO:
{
perform_EventWriteLogInfoEvent(message, file, func, line);
break;
}
case AZ_LOG_VERBOSE:
{
perform_EventWriteLogVerboseEvent(message, file, func, line);
break;
}
default:
break;
}
va_end(args);
}