你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
EventLogger Class
- java.
lang. Object - com.
microsoft. cognitiveservices. speech. diagnostics. logging. EventLogger
- com.
public final class EventLogger
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.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.
Method Summary
Modifier and Type | Method and Description |
---|---|
static void |
setCallback()
Unsets event message logging handler. |
static void |
setCallback(EventLogger.EventHandler handler)
Sets event message logging handler. |
static void |
setFilters()
Clears filters for logging event messages. |
static void |
setFilters(String[] filters)
Sets filters for logging event messages. |
static void |
setLevel(Level level)
Sets the level of the messages to be captured by the logger. |
Methods inherited from java.lang.Object
Method Details
setCallback
public static void setCallback()
Unsets event message logging handler.
setCallback
public static void setCallback(EventLogger.EventHandler handler)
Sets event message logging handler.
Parameters:
You 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.
setFilters
public static void setFilters()
Clears filters for logging event messages.
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:
setLevel
public static void setLevel(Level level)
Sets the level of the messages to be captured by the logger.
Parameters: