Last Updated on : 2024-11-20 08:51:49download
When you debug your application code, logs can help you determine the severity of a problem, identify contributing factors, and quickly resolve them. This topic describes how to configure the logger to suit your requirements.
This section describes the APIs used to configure the logger.
Function prototype | void tuya_user_elog_switch (IN bool on) |
---|---|
Parameter |
|
Feature | Turn on or off logging. The change takes effect after the system restart. Turning on logging will increase power consumption. |
Header file | #include <tuya_user_api.h> |
Return value | None |
Function prototype | char *tuya_user_api_enum2str (ENUM_STR_T *a, int v) |
---|---|
Parameter |
|
Feature | Specify the string that corresponds to a defined enum value as the log output. |
Header file | #include <tuya_user_api.h> |
Return value | The string that corresponds to the specified enum value. |
typedef struct {
int enum_val; // The enum value.
char* string; // The string that corresponds to a specific enum value.
} ENUM_STR_T;
Function prototype | void tuya_user_api_set_sdk_dbg_filter_level (unsigned char filter_level) |
---|---|
Parameter | filter_level : The specified logging level for the SDK. For more information, see filter_level . |
Feature | Set the logging level to classify the entries in the SDK log file in terms of severity. |
Header file | #include <tuya_user_api.h> |
Return value | None |
The macro definition for filter_level
.
The following logging levels are available, from the lowest to the highest. The higher levels always include the messages from the lower levels. For example, if you select ELOG_LVL_INFO
, info, warn, error, and assert messages are included.
ELOG_LVL_ASSERT
: the value of 0. Log events at the assert level.ELOG_LVL_ERROR
: the value of 1. Call USER_API_LOGE
to log events at the error or lower levels.ELOG_LVL_WARN
: the value of 2. Call USER_API_LOGW
to log events at the warn or lower levels.ELOG_LVL_INFO
: the value of 3. Call USER_API_LOGI
to log events at the info or lower levels.ELOG_LVL_DEBUG
: the value of 4. Call USER_API_LOGD
to log events at the debug or lower levels.ELOG_LVL_VERBOSE
: the value of 5. Call USER_API_LOGV
to log events at the verbose or lower levels.Function prototype | #define USER_API_HEX_DUMP(name, width, buf, size) elog_hexdump(name, width, buf, size) |
---|---|
Parameter |
|
Feature | Output logs in hex format |
Header file | #include <tuya_user_api.h> |
Return value | None |
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback