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: doc/manual/style.txt
+15Lines changed: 15 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -225,6 +225,21 @@ if (!buf) {
225
225
}
226
226
@endcode
227
227
228
+
@section stylelogging Logging
229
+
230
+
Logging is intended to provide human-readable information to users.
231
+
Do not confuse logging with the output of commands.
232
+
The latter is intended for the result of a command and should be able to be processed by Tcl scripts.
233
+
234
+
- Use one of the following functions to generate log messages, never use `printf()` or similar functions.
235
+
- Use `LOG_ERROR()` to provide information in case an operation failed in an unrecoverable way. For example, if necessary memory cannot be allocated.
236
+
- Use `LOG_WARNING()` to inform the user of about an unexpected behavior that can be handled and the intended operation is still be performed. For example, in case a command is deprecated but is nevertheless executed.
237
+
- Use `LOG_INFO()` to provide insightful or necessary information to the user. For example, features or capabilities of a discovered target.
238
+
- Use `LOG_DEBUG()` to provide information for troubleshooting. For example, detailed information which makes it easier to debug a specific operation. Try to avoid flooding the log with frequently generated messages. For example, do not use LOG_DEBUG() in operations used for polling the target. Use LOG_DEBUG_IO() for such frequent messages.
239
+
- Use `LOG_DEBUG_IO()` to provide I/O related information for troubleshooting. For example, details about the communication between OpenOCD and a debug adapter.
240
+
- If the log message is related to a target, use the corresponding `LOG_TARGET_xxx()` functions.
241
+
- Do not use a period or exclamation mark at the end of a message.
0 commit comments