mirror of
https://github.com/espressif/openthread.git
synced 2026-07-31 08:07:47 +00:00
[logging] add logging region DNS (#6069)
This commit adds the DNS logging region to be used by OT DNS features.
This commit is contained in:
@@ -298,6 +298,7 @@ if(OT_FULL_LOGS)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_BR=1")
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_CLI=1")
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_COAP=1")
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_DNS=1")
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_DUA=1")
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_ICMP=1")
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_IP6=1")
|
||||
|
||||
@@ -327,6 +327,7 @@ LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_BBR=1
|
||||
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_BR=1
|
||||
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_CLI=1
|
||||
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_COAP=1
|
||||
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_DNS=1
|
||||
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_DUA=1
|
||||
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_ICMP=1
|
||||
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_IP6=1
|
||||
|
||||
@@ -53,7 +53,7 @@ extern "C" {
|
||||
* @note This number versions both OpenThread platform and user APIs.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_API_VERSION (61)
|
||||
#define OPENTHREAD_API_VERSION (62)
|
||||
|
||||
/**
|
||||
* @addtogroup api-instance
|
||||
|
||||
@@ -139,6 +139,7 @@ typedef enum otLogRegion
|
||||
OT_LOG_REGION_DUA = 19, ///< Domain Unicast Address (available since Thread 1.2)
|
||||
OT_LOG_REGION_BR = 20, ///< Border Router
|
||||
OT_LOG_REGION_SRP = 21, ///< Service Registration Protocol (SRP)
|
||||
OT_LOG_REGION_DNS = 22, ///< DNS
|
||||
} otLogRegion;
|
||||
|
||||
/**
|
||||
|
||||
@@ -241,6 +241,7 @@ if (openthread_enable_core_config_args) {
|
||||
"OPENTHREAD_CONFIG_LOG_BR=1",
|
||||
"OPENTHREAD_CONFIG_LOG_CLI=1",
|
||||
"OPENTHREAD_CONFIG_LOG_COAP=1",
|
||||
"OPENTHREAD_CONFIG_LOG_DNS=1",
|
||||
"OPENTHREAD_CONFIG_LOG_DUA=1",
|
||||
"OPENTHREAD_CONFIG_LOG_ICMP=1",
|
||||
"OPENTHREAD_CONFIG_LOG_IP6=1",
|
||||
|
||||
@@ -96,6 +96,7 @@ extern "C" {
|
||||
#define _OT_REGION_DUA_PREFIX "-DUA-----: "
|
||||
#define _OT_REGION_BR_PREFIX "-BR------: "
|
||||
#define _OT_REGION_SRP_PREFIX "-SRP-----: "
|
||||
#define _OT_REGION_DNS_PREFIX "-DNS-----: "
|
||||
#else
|
||||
#define _OT_REGION_API_PREFIX _OT_REGION_SUFFIX
|
||||
#define _OT_REGION_MLE_PREFIX _OT_REGION_SUFFIX
|
||||
@@ -118,6 +119,7 @@ extern "C" {
|
||||
#define _OT_REGION_DUA_PREFIX _OT_REGION_SUFFIX
|
||||
#define _OT_REGION_BR_PREFIX _OT_REGION_SUFFIX
|
||||
#define _OT_REGION_SRP_PREFIX _OT_REGION_SUFFIX
|
||||
#define _OT_REGION_DNS_PREFIX _OT_REGION_SUFFIX
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -1362,6 +1364,64 @@ void otLogCertMeshCoP(const char *aFormat, ...);
|
||||
#define otLogDebgSrp(...)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def otLogCritDns
|
||||
*
|
||||
* This function generates a log with level critical for the DNS region.
|
||||
*
|
||||
* @param[in] ... Arguments for the format specification.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def otLogWarnDns
|
||||
*
|
||||
* This function generates a log with level warning for the DNS region.
|
||||
*
|
||||
* @param[in] ... Arguments for the format specification.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def otLogNoteDns
|
||||
*
|
||||
* This function generates a log with level note for the DNS region.
|
||||
*
|
||||
* @param[in] ... Arguments for the format specification.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def otLogInfoDns
|
||||
*
|
||||
* This function generates a log with level info for the DNS region.
|
||||
*
|
||||
* @param[in] ... Arguments for the format specification.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def otLogDebgDns
|
||||
*
|
||||
* This function generates a log with level debug for the DNS region.
|
||||
*
|
||||
* @param[in] ... Arguments for the format specification.
|
||||
*
|
||||
*/
|
||||
#if OPENTHREAD_CONFIG_LOG_DNS
|
||||
#define otLogCritDns(...) otLogCrit(OT_LOG_REGION_DNS, _OT_REGION_DNS_PREFIX, __VA_ARGS__)
|
||||
#define otLogWarnDns(...) otLogWarn(OT_LOG_REGION_DNS, _OT_REGION_DNS_PREFIX, __VA_ARGS__)
|
||||
#define otLogNoteDns(...) otLogNote(OT_LOG_REGION_DNS, _OT_REGION_DNS_PREFIX, __VA_ARGS__)
|
||||
#define otLogInfoDns(...) otLogInfo(OT_LOG_REGION_DNS, _OT_REGION_DNS_PREFIX, __VA_ARGS__)
|
||||
#define otLogDebgDns(...) otLogDebg(OT_LOG_REGION_DNS, _OT_REGION_DNS_PREFIX, __VA_ARGS__)
|
||||
#else
|
||||
#define otLogCritDns(...)
|
||||
#define otLogWarnDns(...)
|
||||
#define otLogNoteDns(...)
|
||||
#define otLogInfoDns(...)
|
||||
#define otLogDebgDns(...)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def otLogCritPlat
|
||||
*
|
||||
@@ -2265,6 +2325,74 @@ void otLogOtns(const char *aFormat, ...);
|
||||
#define otDumpDebgSrp(aId, aBuf, aLength)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def otDumpCritDns
|
||||
*
|
||||
* This function generates a memory dump with log level critical and region DNS.
|
||||
*
|
||||
* @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 otDumpWarnDns
|
||||
*
|
||||
* This function generates a memory dump with log level warning and region DNS.
|
||||
*
|
||||
* @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 otDumpNoteDns
|
||||
*
|
||||
* This function generates a memory dump with log level note and region DNS.
|
||||
*
|
||||
* @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 otDumpInfoDns
|
||||
*
|
||||
* This function generates a memory dump with log level info and region DNS.
|
||||
*
|
||||
* @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 otDumpDebgDns
|
||||
*
|
||||
* This function generates a memory dump with log level debug and region DNS.
|
||||
*
|
||||
* @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_SRP
|
||||
#define otDumpCritDns(aId, aBuf, aLength) otDumpCrit(OT_LOG_REGION_SRP, aId, aBuf, aLength)
|
||||
#define otDumpWarnDns(aId, aBuf, aLength) otDumpWarn(OT_LOG_REGION_SRP, aId, aBuf, aLength)
|
||||
#define otDumpNoteDns(aId, aBuf, aLength) otDumpNote(OT_LOG_REGION_SRP, aId, aBuf, aLength)
|
||||
#define otDumpInfoDns(aId, aBuf, aLength) otDumpInfo(OT_LOG_REGION_SRP, aId, aBuf, aLength)
|
||||
#define otDumpDebgDns(aId, aBuf, aLength) otDumpDebg(OT_LOG_REGION_SRP, aId, aBuf, aLength)
|
||||
#else
|
||||
#define otDumpCritDns(aId, aBuf, aLength)
|
||||
#define otDumpWarnDns(aId, aBuf, aLength)
|
||||
#define otDumpNoteDns(aId, aBuf, aLength)
|
||||
#define otDumpInfoDns(aId, aBuf, aLength)
|
||||
#define otDumpDebgDns(aId, aBuf, aLength)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def otDumpCritMem
|
||||
*
|
||||
|
||||
@@ -319,6 +319,16 @@
|
||||
#define OPENTHREAD_CONFIG_LOG_SRP 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_LOG_DNS
|
||||
*
|
||||
* Define to enable DNS region logging.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_LOG_DNS
|
||||
#define OPENTHREAD_CONFIG_LOG_DNS 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL
|
||||
*
|
||||
|
||||
@@ -198,7 +198,7 @@ exit:
|
||||
if (error != OT_ERROR_NONE)
|
||||
{
|
||||
FreeMessage(messageCopy);
|
||||
otLogWarnIp6("Failed to send DNS request: %s", otThreadErrorToString(error));
|
||||
otLogWarnDns("Failed to send DNS request: %s", otThreadErrorToString(error));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -694,6 +694,7 @@ enum
|
||||
SPINEL_NCP_LOG_REGION_OT_DUA = 19,
|
||||
SPINEL_NCP_LOG_REGION_OT_BR = 20,
|
||||
SPINEL_NCP_LOG_REGION_OT_SRP = 21,
|
||||
SPINEL_NCP_LOG_REGION_OT_DNS = 22,
|
||||
};
|
||||
|
||||
enum
|
||||
|
||||
@@ -632,6 +632,10 @@ unsigned int NcpBase::ConvertLogRegion(otLogRegion aLogRegion)
|
||||
case OT_LOG_REGION_SRP:
|
||||
spinelLogRegion = SPINEL_NCP_LOG_REGION_OT_SRP;
|
||||
break;
|
||||
|
||||
case OT_LOG_REGION_DNS:
|
||||
spinelLogRegion = SPINEL_NCP_LOG_REGION_OT_DNS;
|
||||
break;
|
||||
}
|
||||
|
||||
return spinelLogRegion;
|
||||
|
||||
Reference in New Issue
Block a user