TTS_LOG_EVENT_CB
Invoked when the engine instance has events related to application tuning and capacity planning to deliver to the application.
typedef LH_VOID (*TTS_LOG_EVENT_CB)(
LH_VOID* pAppData,
const wchar_t* szEvent,
const VXIVector* pKeys,
const VXIVector* pValues);
Argument |
Description |
---|---|
pAppData |
Application data pointer that was passed into TtsOpen. |
szEvent |
[out] Event name. |
pKeys |
[out] Vector containing the event token key strings. |
pValues |
[out] Vector containing the event token value strings. |
This function provides detailed event information, which allows applications to generate application trace logs or capture and report statistical information such as license use.
To register your callback, see TTS_OPEN_PARAMS.
To enable, set log_cb_enabled to true.
For a list of the events and tokens, see Application call logs.
Return values: None.
Note: The VXIVector parameters represent the keys and values as they make up the arguments of the complete event string. The number of elements in both vectors must be the same at all times , and their values must be strings (VALUE_STRING).
A typical usage of these VXIVectors is shown in the nvscmdline sample application, which is shipped with the product.
Sample code:
static LH_VOID TtsLogEventCb(LH_VOID* lpAppData,
const wchar_t* szEvent,
const VXIVector* lpKeys,
const VXIVector* lpValues)
{
std::wstring strMessage;
for (size_t i = 0;
(i < VXIVectorLength(lpKeys)) &&
(i < VXIVectorLength(lpValues)); i++)
{
if (i > 0) strMessage += L", ";
strMessage += VXIStringCStr((const VXIString *)
VXIVectorGetElement(lpKeys, i));
strMessage += L"=";
strMessage += VXIStringCStr((const VXIString *)
VXIVectorGetElement(lpValues, i));
}
// This shows logging the event to the console
wprintf(L"EVENT %s: %s\n", szEvent, strMessage.c_str());
// This shows forwarding the event to the Nuance
// Recognizer for inclusion in its call logs, giving a
// merged Recognizer and Vocalizer call log for application
// tuning and capacity planning.
//
SWIrecLogEvent(rec, szEvent, strMessage.c_str());
}