mirror of
https://github.com/espressif/openthread.git
synced 2026-08-26 04:09:52 +00:00
[logging] add MLR log region (#5250)
This commit is contained in:
@@ -244,6 +244,7 @@ if(OT_FULL_LOGS)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_MEM=1")
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_MESHCOP=1")
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_MLE=1")
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_MLR=1")
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_NETDATA=1")
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_NETDIAG=1")
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_PKT_DUMP=1")
|
||||
|
||||
@@ -292,6 +292,7 @@ LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_MAC=1
|
||||
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_MEM=1
|
||||
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_MESHCOP=1
|
||||
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_MLE=1
|
||||
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_MLR=1
|
||||
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_NETDATA=1
|
||||
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_NETDIAG=1
|
||||
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_PKT_DUMP=1
|
||||
|
||||
@@ -53,7 +53,7 @@ extern "C" {
|
||||
* @note This number versions both OpenThread platform and user APIs.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_API_VERSION (15)
|
||||
#define OPENTHREAD_API_VERSION (16)
|
||||
|
||||
/**
|
||||
* @addtogroup api-instance
|
||||
|
||||
@@ -135,6 +135,7 @@ typedef enum otLogRegion
|
||||
OT_LOG_REGION_CORE = 15, ///< OpenThread Core
|
||||
OT_LOG_REGION_UTIL = 16, ///< Utility module
|
||||
OT_LOG_REGION_BBR = 17, ///< Backbone Router (available since Thread 1.2)
|
||||
OT_LOG_REGION_MLR = 18, ///< Multicast Listener Registration (available since Thread 1.2)
|
||||
} otLogRegion;
|
||||
|
||||
/**
|
||||
|
||||
@@ -90,6 +90,7 @@ extern "C" {
|
||||
#define _OT_REGION_CORE_PREFIX "-CORE----: "
|
||||
#define _OT_REGION_UTIL_PREFIX "-UTIL----: "
|
||||
#define _OT_REGION_BBR_PREFIX "-BBR-----: "
|
||||
#define _OT_REGION_MLR_PREFIX "-MLR-----: "
|
||||
#else
|
||||
#define _OT_REGION_API_PREFIX _OT_REGION_SUFFIX
|
||||
#define _OT_REGION_MLE_PREFIX _OT_REGION_SUFFIX
|
||||
@@ -108,6 +109,7 @@ extern "C" {
|
||||
#define _OT_REGION_CORE_PREFIX _OT_REGION_SUFFIX
|
||||
#define _OT_REGION_UTIL_PREFIX _OT_REGION_SUFFIX
|
||||
#define _OT_REGION_BBR_PREFIX _OT_REGION_SUFFIX
|
||||
#define _OT_REGION_MLR_PREFIX _OT_REGION_SUFFIX
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -483,6 +485,64 @@ extern "C" {
|
||||
#define otLogDebgBbr(...)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def otLogCritMlr
|
||||
*
|
||||
* This method generates a log with level critical for the Multicast Listener Registration (MLR) region.
|
||||
*
|
||||
* @param[in] ... Arguments for the format specification.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def otLogWarnMlr
|
||||
*
|
||||
* This method generates a log with level warning for the Multicast Listener Registration (MLR) region.
|
||||
*
|
||||
* @param[in] ... Arguments for the format specification.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def otLogNoteMlr
|
||||
*
|
||||
* This method generates a log with level note for the Multicast Listener Registration (MLR) region.
|
||||
*
|
||||
* @param[in] ... Arguments for the format specification.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def otLogInfoMlr
|
||||
*
|
||||
* This method generates a log with level info for the Multicast Listener Registration (MLR) region.
|
||||
*
|
||||
* @param[in] ... Arguments for the format specification.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def otLogDebgMlr
|
||||
*
|
||||
* This method generates a log with level debug for the Multicast Listener Registration (MLR) region.
|
||||
*
|
||||
* @param[in] ... Arguments for the format specification.
|
||||
*
|
||||
*/
|
||||
#if OPENTHREAD_CONFIG_LOG_MLR == 1
|
||||
#define otLogCritMlr(...) otLogCrit(OT_LOG_REGION_MLR, _OT_REGION_MLR_PREFIX __VA_ARGS__)
|
||||
#define otLogWarnMlr(...) otLogWarn(OT_LOG_REGION_MLR, _OT_REGION_MLR_PREFIX __VA_ARGS__)
|
||||
#define otLogNoteMlr(...) otLogNote(OT_LOG_REGION_MLR, _OT_REGION_MLR_PREFIX __VA_ARGS__)
|
||||
#define otLogInfoMlr(...) otLogInfo(OT_LOG_REGION_MLR, _OT_REGION_MLR_PREFIX __VA_ARGS__)
|
||||
#define otLogDebgMlr(...) otLogDebg(OT_LOG_REGION_MLR, _OT_REGION_MLR_PREFIX __VA_ARGS__)
|
||||
#else
|
||||
#define otLogCritMlr(...)
|
||||
#define otLogWarnMlr(...)
|
||||
#define otLogNoteMlr(...)
|
||||
#define otLogInfoMlr(...)
|
||||
#define otLogDebgMlr(...)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def otLogCritNetData
|
||||
*
|
||||
@@ -1523,6 +1583,74 @@ extern "C" {
|
||||
#define otDumpDebgBbr(aId, aBuf, aLength)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def otDumpCritMlr
|
||||
*
|
||||
* This method generates a memory dump with log level critical and region Multicast Listener Registration (MLR).
|
||||
*
|
||||
* @param[in] aId A pointer to a NULL-terminated string that is printed before the bytes.
|
||||
* @param[in] aBuf A pointer to the buffer.
|
||||
* @param[in] aLength Number of bytes to print.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def otDumpWarnMlr
|
||||
*
|
||||
* This method generates a memory dump with log level warning and region Multicast Listener Registration (MLR).
|
||||
*
|
||||
* @param[in] aId A pointer to a NULL-terminated string that is printed before the bytes.
|
||||
* @param[in] aBuf A pointer to the buffer.
|
||||
* @param[in] aLength Number of bytes to print.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def otDumpNoteMlr
|
||||
*
|
||||
* This method generates a memory dump with log level note and region Multicast Listener Registration (MLR).
|
||||
*
|
||||
* @param[in] aId A pointer to a NULL-terminated string that is printed before the bytes.
|
||||
* @param[in] aBuf A pointer to the buffer.
|
||||
* @param[in] aLength Number of bytes to print.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def otDumpInfoMlr
|
||||
*
|
||||
* This method generates a memory dump with log level info and region Multicast Listener Registration (MLR).
|
||||
*
|
||||
* @param[in] aId A pointer to a NULL-terminated string that is printed before the bytes.
|
||||
* @param[in] aBuf A pointer to the buffer.
|
||||
* @param[in] aLength Number of bytes to print.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def otDumpDebgMlr
|
||||
*
|
||||
* This method generates a memory dump with log level debug and region Multicast Listener Registration (MLR).
|
||||
*
|
||||
* @param[in] aId A pointer to a NULL-terminated string that is printed before the bytes.
|
||||
* @param[in] aBuf A pointer to the buffer.
|
||||
* @param[in] aLength Number of bytes to print.
|
||||
*
|
||||
*/
|
||||
#if OPENTHREAD_CONFIG_LOG_MLR == 1
|
||||
#define otDumpCritMlr(aId, aBuf, aLength) otDumpCrit(OT_LOG_REGION_MLR, aId, aBuf, aLength)
|
||||
#define otDumpWarnMlr(aId, aBuf, aLength) otDumpWarn(OT_LOG_REGION_MLR, aId, aBuf, aLength)
|
||||
#define otDumpNoteMlr(aId, aBuf, aLength) otDumpNote(OT_LOG_REGION_MLR, aId, aBuf, aLength)
|
||||
#define otDumpInfoMlr(aId, aBuf, aLength) otDumpInfo(OT_LOG_REGION_MLR, aId, aBuf, aLength)
|
||||
#define otDumpDebgMlr(aId, aBuf, aLength) otDumpDebg(OT_LOG_REGION_MLR, aId, aBuf, aLength)
|
||||
#else
|
||||
#define otDumpCritMlr(aId, aBuf, aLength)
|
||||
#define otDumpWarnMlr(aId, aBuf, aLength)
|
||||
#define otDumpNoteMlr(aId, aBuf, aLength)
|
||||
#define otDumpInfoMlr(aId, aBuf, aLength)
|
||||
#define otDumpDebgMlr(aId, aBuf, aLength)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def otDumpCritIcmp
|
||||
*
|
||||
|
||||
@@ -275,6 +275,18 @@
|
||||
#define OPENTHREAD_CONFIG_LOG_BBR 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_LOG_MLR
|
||||
*
|
||||
* Note: available since Thread 1.2.
|
||||
*
|
||||
* Define to enable Multicast Listener Registration (MLR) region logging.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_LOG_MLR
|
||||
#define OPENTHREAD_CONFIG_LOG_MLR 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL
|
||||
*
|
||||
|
||||
@@ -644,6 +644,7 @@ enum
|
||||
SPINEL_NCP_LOG_REGION_OT_CORE = 15,
|
||||
SPINEL_NCP_LOG_REGION_OT_UTIL = 16,
|
||||
SPINEL_NCP_LOG_REGION_OT_BBR = 17,
|
||||
SPINEL_NCP_LOG_REGION_OT_MLR = 18,
|
||||
};
|
||||
|
||||
enum
|
||||
|
||||
@@ -612,6 +612,9 @@ unsigned int NcpBase::ConvertLogRegion(otLogRegion aLogRegion)
|
||||
case OT_LOG_REGION_BBR:
|
||||
spinelLogRegion = SPINEL_NCP_LOG_REGION_OT_BBR;
|
||||
break;
|
||||
case OT_LOG_REGION_MLR:
|
||||
spinelLogRegion = SPINEL_NCP_LOG_REGION_OT_MLR;
|
||||
break;
|
||||
}
|
||||
|
||||
return spinelLogRegion;
|
||||
|
||||
Reference in New Issue
Block a user