Share via


FileLogger Class

A static class to control file-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. FileLogger is the simplest logging solution and suitable for diagnosing most on-device issues when running Speech SDK. Added in version 1.43.0

File logging is a process wide construct. That means that if (for example) you have multiple speech recognizer objects running in parallel, there will be one log file containing interleaved log lines from all recognizers. You cannot get a separate log file for each recognizer.

Constructor

FileLogger()

Methods

set_filters

Sets filters for logging messages to a file. Once filters are set, file logger will only be updated with log strings containing at least one of the strings specified by the filters. The match is case sensitive.

set_level

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

start

Starts logging to a file. If the file already exists, it will be overwritten unless append is set to True.

stop

Stops logging to a file. This call is optional. If logging has been started, the log file will be written when the process exits normally.

set_filters

Sets filters for logging messages to a file. Once filters are set, file logger will only be updated with log strings containing at least one of the strings specified by the filters. The match is case sensitive.

static set_filters(filters: List[str] = [])

Parameters

Name Description
filters

Filters to use, or an empty list to remove previously set filters.

Default value: []

set_level

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

static set_level(level: LogLevel = LogLevel.Info)

Parameters

Name Description
level

Maximum level of detail to be captured by the logger.

Default value: LogLevel.Info

start

Starts logging to a file. If the file already exists, it will be overwritten unless append is set to True.

static start(file_path: str, append: bool = False)

Parameters

Name Description
file_path
Required
append
Default value: False

stop

Stops logging to a file. This call is optional. If logging has been started, the log file will be written when the process exits normally.

static stop()