[logging] refine BBR log level (#6270)

This commit refines BBR log level usage using otLogResultBbr.
This commit is contained in:
Simon Lin
2021-03-12 09:22:19 -08:00
committed by GitHub
parent dcc9472ba1
commit 3852ac3d3e
3 changed files with 17 additions and 25 deletions
+3 -16
View File
@@ -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
+1 -8
View File
@@ -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");
}
}
}
+13 -1
View File
@@ -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
}