mirror of
https://github.com/espressif/openthread.git
synced 2026-08-10 20:57:47 +00:00
[logging] refine BBR log level (#6270)
This commit refines BBR log level usage using otLogResultBbr.
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE
|
||||
|
||||
#include "common/locator-getters.hpp"
|
||||
#include "common/logging.hpp"
|
||||
|
||||
namespace ot {
|
||||
namespace BackboneRouter {
|
||||
@@ -83,14 +84,7 @@ void BackboneTmfAgent::SubscribeMulticast(const Ip6::Address &aAddress)
|
||||
|
||||
error = mSocket.JoinNetifMulticastGroup(OT_NETIF_BACKBONE, aAddress);
|
||||
|
||||
if (error != OT_ERROR_NONE)
|
||||
{
|
||||
otLogDebgBbr("Backbone TMF subscribes %s: %s", aAddress.ToString().AsCString(), otThreadErrorToString(error));
|
||||
}
|
||||
else
|
||||
{
|
||||
otLogCritBbr("Backbone TMF subscribes %s: %s", aAddress.ToString().AsCString(), otThreadErrorToString(error));
|
||||
}
|
||||
otLogResultBbr(error, "Backbone TMF subscribes %s", aAddress.ToString().AsCString());
|
||||
}
|
||||
|
||||
void BackboneTmfAgent::UnsubscribeMulticast(const Ip6::Address &aAddress)
|
||||
@@ -99,14 +93,7 @@ void BackboneTmfAgent::UnsubscribeMulticast(const Ip6::Address &aAddress)
|
||||
|
||||
error = mSocket.LeaveNetifMulticastGroup(OT_NETIF_BACKBONE, aAddress);
|
||||
|
||||
if (error == OT_ERROR_NONE)
|
||||
{
|
||||
otLogDebgBbr("Backbone TMF unsubscribes %s: %s", aAddress.ToString().AsCString(), otThreadErrorToString(error));
|
||||
}
|
||||
else
|
||||
{
|
||||
otLogCritBbr("Backbone TMF unsubscribes %s: %s", aAddress.ToString().AsCString(), otThreadErrorToString(error));
|
||||
}
|
||||
otLogResultBbr(error, "Backbone TMF unsubscribes %s", aAddress.ToString().AsCString());
|
||||
}
|
||||
|
||||
} // namespace BackboneRouter
|
||||
|
||||
@@ -129,14 +129,7 @@ void Manager::HandleNotifierEvents(Events aEvents)
|
||||
|
||||
error = mBackboneTmfAgent.Start();
|
||||
|
||||
if (error != OT_ERROR_NONE)
|
||||
{
|
||||
otLogCritBbr("Start Backbone TMF agent: %s", otThreadErrorToString(error));
|
||||
}
|
||||
else
|
||||
{
|
||||
otLogInfoBbr("Start Backbone TMF agent: %s", otThreadErrorToString(error));
|
||||
}
|
||||
otLogResultBbr(error, "Start Backbone TMF agent");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2565,7 +2565,19 @@ const char *otLogLevelToPrefixString(otLogLevel aLogLevel);
|
||||
* @param[in] ... Arguments for the format specification.
|
||||
*
|
||||
*/
|
||||
#define otLogResultPlat(aError, ...) _otLogResult(Plat, aError, OT_FIRST_ARG(__VA_ARGS__) OT_REST_ARGS(__VA_ARGS__))
|
||||
#define otLogResultPlat(aError, ...) _otLogResult(Plat, aError, __VA_ARGS__)
|
||||
|
||||
/**
|
||||
* @def otLogResultBbr
|
||||
*
|
||||
* This function generates a log for the BBR region according to the error result. If @p aError is `OT_ERROR_NONE`, the
|
||||
* log level is info. Otherwise the log level is warn.
|
||||
*
|
||||
* @param[in] aError The error result.
|
||||
* @param[in] ... Arguments for the format specification.
|
||||
*
|
||||
*/
|
||||
#define otLogResultBbr(aError, ...) _otLogResult(Bbr, aError, __VA_ARGS__)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user