You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/cognitive-services/Speech-Service/how-to-use-logging.md
+23-16Lines changed: 23 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,38 +18,45 @@ Logging to file is an optional feature for the Speech SDK. During development lo
18
18
19
19
## Sample
20
20
21
-
The log file name is specified on a configuration object. Taking the `SpeechConfig` as an example and assuming that you have created an instance called `config`:
21
+
The log file name is specified on a configuration object. Taking the `SpeechConfig` as an example and assuming that you've created an instance called `speechConfig`:
You can create a recognizer from the config object. This will enable logging for all recognizers.
49
+
You can create a recognizer from the configuration object. This will enable logging for all recognizers.
50
50
51
51
> [!NOTE]
52
-
> If you create a `SpeechSynthesizer` from the config object, it will not enable logging. If logging is enabled though, you will also receive diagnostics from the `SpeechSynthesizer`.
52
+
> If you create a `SpeechSynthesizer` from the configuration object, it will not enable logging. If logging is enabled though, you will also receive diagnostics from the `SpeechSynthesizer`.
53
+
54
+
JavaScript is an exception where the logging is enabled via SDK diagnostics as shown in the following code snippet:
The code above will save a log file to the external storage in the root of an application-specific directory. A user can access the file with the file manager (usually in `Android/data/ApplicationName/logfile.txt`). The file will be deleted when the application is uninstalled.
@@ -101,7 +108,7 @@ Within a Unity Android application, the log file can be created using the applic
In addition, you need to also set write permission in your Unity Player settings for Android to "External (SDCard)". The log will be written
107
114
to a directory you can get using a tool such as AndroidStudio Device File Explorer. The exact directory path may vary between Android devices,
@@ -131,7 +138,7 @@ To access a created file, add the below properties to the `Info.plist` property
131
138
<true/>
132
139
```
133
140
134
-
If you are using Swift on iOS, please use the following code snippet to enable logs:
141
+
If you're using Swift on iOS, please use the following code snippet to enable logs:
135
142
```swift
136
143
let documentsDirectoryPathString =NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first!
137
144
let documentsDirectoryPath =NSURL(string: documentsDirectoryPathString)!
@@ -145,9 +152,9 @@ More about iOS File System is available [here](https://developer.apple.com/libra
145
152
146
153
Although a log file output path is specified as a configuration property into a `SpeechRecognizer` or other SDK object, SDK logging is a singleton, *process-wide* facility with no concept of individual instances. You can think of this as the `SpeechRecognizer` constructor (or similar) implicitly calling a static and internal "Configure Global Logging" routine with the property data available in the corresponding `SpeechConfig`.
147
154
148
-
This means that you cannot, as an example, configure six parallel recognizers to output simultaneously to six separate files. Instead, the latest recognizer created will configure the global logging instance to output to the file specified in its configuration properties and all SDK logging will be emitted to that file.
155
+
This means that you can't, as an example, configure six parallel recognizers to output simultaneously to six separate files. Instead, the latest recognizer created will configure the global logging instance to output to the file specified in its configuration properties and all SDK logging will be emitted to that file.
149
156
150
-
This also means that the lifetime of the object that configured logging is not tied to the duration of logging. Logging will not stop in response to the release of an SDK object and will continue as long as no new logging configuration is provided. Once started, process-wide logging may be stopped by setting the log file path to an empty string when creating a new object.
157
+
This also means that the lifetime of the object that configured logging isn't tied to the duration of logging. Logging will not stop in response to the release of an SDK object and will continue as long as no new logging configuration is provided. Once started, process-wide logging may be stopped by setting the log file path to an empty string when creating a new object.
151
158
152
159
To reduce potential confusion when configuring logging for multiple instances, it may be useful to abstract control of logging from objects doing real work. An example pair of helper routines:
0 commit comments