From 2b7298bf9becf8087e5a9e75a6958f3868e69831 Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Fri, 2 Feb 2018 09:04:21 -0800 Subject: [PATCH] [logging] use core log region for Notifier, and util for child supervision (#2528) This commit also updated windows-logging to add new core and util related logs. --- include/openthread/platform/logging-windows.h | 57 +++++++++++++++++++ src/core/common/notifier.cpp | 2 +- src/core/utils/child_supervision.cpp | 4 +- 3 files changed, 60 insertions(+), 3 deletions(-) diff --git a/include/openthread/platform/logging-windows.h b/include/openthread/platform/logging-windows.h index 82a5aea9d..71f23392d 100644 --- a/include/openthread/platform/logging-windows.h +++ b/include/openthread/platform/logging-windows.h @@ -392,6 +392,63 @@ // USESUFFIX(otLogDebgMacErr, ", %!otError!", EXP); // end_wpp +// ==CORE== + +// begin_wpp config +// USEPREFIX (otLogCritCore, "[%p]CORE%!SPACE!", &CTX); +// otLogCritCore{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_MAC}(CTX, MSG, ...); +// end_wpp + +// begin_wpp config +// USEPREFIX (otLogWarnCore, "[%p]CORE%!SPACE!", &CTX); +// otLogWarnCore{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_MAC}(CTX, MSG, ...); +// end_wpp + +// begin_wpp config +// USEPREFIX (otLogInfoCore, "[%p]CORE%!SPACE!", &CTX); +// otLogInfoCore{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_MAC}(CTX, MSG, ...); +// end_wpp + +// begin_wpp config +// USEPREFIX (otLogDebgCore, "[%p]CORE%!SPACE!", &CTX); +// otLogDebgCore{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_MAC}(CTX, MSG, ...); +// end_wpp + +// begin_wpp config +// USEPREFIX (otLogDebgCoreErr, "[%p]CORE%!SPACE!", &CTX); +// otLogDebgCoreErr{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_MAC}(CTX, EXP, MSG, ...); +// USESUFFIX(otLogDebgCoreErr, ", %!otError!", EXP); +// end_wpp + +// ==UTIL== + +// begin_wpp config +// USEPREFIX (otLogCritUtil, "[%p]UTIL%!SPACE!", &CTX); +// otLogCritUtil{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_MAC}(CTX, MSG, ...); +// end_wpp + +// begin_wpp config +// USEPREFIX (otLogWarnUtil, "[%p]UTIL%!SPACE!", &CTX); +// otLogWarnUtil{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_MAC}(CTX, MSG, ...); +// end_wpp + +// begin_wpp config +// USEPREFIX (otLogInfoUtil, "[%p]UTIL%!SPACE!", &CTX); +// otLogInfoUtil{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_MAC}(CTX, MSG, ...); +// end_wpp + +// begin_wpp config +// USEPREFIX (otLogDebgUtil, "[%p]UTIL%!SPACE!", &CTX); +// otLogDebgUtil{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_MAC}(CTX, MSG, ...); +// end_wpp + +// begin_wpp config +// USEPREFIX (otLogDebgUtilErr, "[%p]UTIL%!SPACE!", &CTX); +// otLogDebgUtilErr{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_MAC}(CTX, EXP, MSG, ...); +// USESUFFIX(otLogDebgUtilErr, ", %!otError!", EXP); +// end_wpp + + // ==MEM== // begin_wpp config diff --git a/src/core/common/notifier.cpp b/src/core/common/notifier.cpp index 31f709d0d..6a4fa79eb 100644 --- a/src/core/common/notifier.cpp +++ b/src/core/common/notifier.cpp @@ -219,7 +219,7 @@ void Notifier::LogChangedFlags(uint32_t aFlags) const exit: stringBuffer[sizeof(stringBuffer) - 1] = 0; - otLogInfoMle(GetInstance(), "Notifier: StateChanged (0x%04x) [ %s] ", aFlags, stringBuffer); + otLogInfoCore(GetInstance(), "Notifier: StateChanged (0x%04x) [ %s] ", aFlags, stringBuffer); } const char *Notifier::FlagToString(uint32_t aFlag) const diff --git a/src/core/utils/child_supervision.cpp b/src/core/utils/child_supervision.cpp index eb55b12b5..9206d503d 100644 --- a/src/core/utils/child_supervision.cpp +++ b/src/core/utils/child_supervision.cpp @@ -116,7 +116,7 @@ void ChildSupervisor::SendMessage(Child &aChild) SuccessOrExit(netif.SendMessage(*message)); message = NULL; - otLogInfoMle(GetInstance(), "Sending supervision message to child 0x%04x", aChild.GetRloc16()); + otLogInfoUtil(GetInstance(), "Sending supervision message to child 0x%04x", aChild.GetRloc16()); exit: @@ -237,7 +237,7 @@ void SupervisionListener::HandleTimer(void) VerifyOrExit((netif.GetMle().GetRole() == OT_DEVICE_ROLE_CHILD) && (netif.GetMeshForwarder().GetRxOnWhenIdle() == false)); - otLogWarnMle(netif.GetInstance(), "Supervision timeout. No frame from parent in %d sec", mTimeout); + otLogWarnUtil(netif.GetInstance(), "Supervision timeout. No frame from parent in %d sec", mTimeout); netif.GetMle().SendChildUpdateRequest();