Class EventLogger
- java.lang.Object
-
- com.microsoft.cognitiveservices.speech.diagnostics.logging.EventLogger
-
public final class EventLogger extends Object
A static class to control event-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.42.0Event 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceEventLogger.EventHandlerAn interface to be implemented as an event message handler for the event logger.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidsetCallback()Unsets event message logging handler.static voidsetCallback(EventLogger.EventHandler handler)Sets event message logging handler.static voidsetFilters()Clears filters for logging event messages.static voidsetFilters(String[] filters)Sets filters for logging event messages.static voidsetLevel(Level level)Sets the level of the messages to be captured by the logger.
-
-
-
Method Detail
-
setCallback
public static void setCallback(EventLogger.EventHandler handler)
Sets event message logging handler.- Parameters:
handler- Event message handler. null to remove the handler from the loggerYou can only subscribe once to the event. The event thread is a working thread of the SDK, so the log string should be copied somewhere for further processing by another thread, and return immediately from the handler. No heavy processing or network calls should be done in the handler subscribed to this event.
-
setCallback
public static void setCallback()
Unsets event message logging handler.
-
setFilters
public static void setFilters(String[] filters)
Sets filters for logging event messages. Once filters are set, event logger will only be updated with log strings containing at least one of the strings specified by the filters. The match is case sensitive.- Parameters:
filters- Filters to use, or an empty list to remove previously set filters.
-
setFilters
public static void setFilters()
Clears filters for logging event messages.
-
setLevel
public 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.
-
-