class Diagnostics::Logging::EventLogger

Class with static methods to control callback-based SDK logging. Turning on logging while running your Speech SDK scenario provides detailed information from the SDK's core native components. If you report an issue to Microsoft, you may be asked to provide logs to help Microsoft diagnose the issue. Your application should not take dependency on particular log strings, as they may change from one SDK release to another without notice. Use EventLogger when you want to get access to new log strings as soon as they are available, and you need to further process them. For example, integrating Speech SDK logs with your existing logging collection system. Added in version 1.20.0.

Event logging is a process wide construct. That means that if (for example) you have multiple speech recognizer objects running in parallel, you can only register one callback function to receive interleaved logs from all recognizers. You cannot register a separate callback for each recognizer.

Members

SetCallback

Syntax: public inline static void SetCallback ( CallbackFunction_Type callback );

Register a callback function that will be invoked for each new log messages.

Parameters

  • callback callback function to call. Set a nullptr value to stop the Event Logger.

You can only register one callback function. This call will happen on a working thread of the SDK, so the log string should be copied somewhere for further processing by another thread, and the function should return immediately. No heavy processing or network calls should be done in this callback function.

SetFilters

Syntax: public inline static void SetFilters ( std::initializer_list< std::string > filters );

Sets or clears filters for callbacks. Once filters are set, the callback will be invoked only if the log string contains at least one of the strings specified by the filters. The match is case sensitive.

Parameters

  • filters Optional. Filters to use, or an empty list to clear previously set filters

SetLevel

Syntax: public inline static void SetLevel ( Level level );

Sets the level of the messages to be captured by the logger.

Parameters

  • level Maximum level of detail to be captured by the logger.

CallbackFunction_Type

Syntax: typedef CallbackFunction_Type;