From 309bd09d7590e8d823db28d3d9dd0f67700c31ec Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Thu, 25 Oct 2018 09:14:43 -0700 Subject: [PATCH] [logging] remove aInstance as input parameter to logging macros (#3184) --- Android.mk | 1 + etc/visual-studio/libopenthread.vcxproj | 1 + .../libopenthread.vcxproj.filters | 3 + examples/platforms/cc2538/radio.c | 62 +- examples/platforms/da15000/radio.c | 42 +- examples/platforms/efr32/radio.c | 36 +- examples/platforms/samr21/radio.c | 22 +- include/openthread/Makefile.am | 1 + include/openthread/instance.h | 23 - include/openthread/logging.h | 87 ++ include/openthread/platform/logging-windows.h | 352 ++++---- src/cli/cli_uart.cpp | 2 +- src/core/Makefile.am | 2 + src/core/api/instance_api.cpp | 35 +- src/core/api/link_raw_api.cpp | 8 +- src/core/api/logging_api.cpp | 69 ++ src/core/coap/coap.cpp | 4 +- src/core/common/instance.hpp | 31 +- src/core/common/logging.cpp | 21 +- src/core/common/logging.hpp | 841 +++++++----------- src/core/common/message.cpp | 2 +- src/core/common/notifier.cpp | 2 +- src/core/common/settings.cpp | 23 +- src/core/mac/link_raw.cpp | 16 +- src/core/mac/mac.cpp | 50 +- src/core/meshcop/announce_begin_client.cpp | 2 +- src/core/meshcop/border_agent.cpp | 35 +- src/core/meshcop/commissioner.cpp | 47 +- src/core/meshcop/dataset.cpp | 4 +- src/core/meshcop/dataset_local.cpp | 4 +- src/core/meshcop/dataset_manager.cpp | 8 +- src/core/meshcop/dataset_manager_ftd.cpp | 8 +- src/core/meshcop/dtls.cpp | 42 +- src/core/meshcop/energy_scan_client.cpp | 6 +- src/core/meshcop/joiner.cpp | 32 +- src/core/meshcop/joiner_router.cpp | 20 +- src/core/meshcop/leader.cpp | 12 +- src/core/meshcop/panid_query_client.cpp | 6 +- src/core/net/dhcp6_client.cpp | 2 +- src/core/net/icmp6.cpp | 10 +- src/core/net/ip6.cpp | 16 +- src/core/thread/address_resolver.cpp | 33 +- src/core/thread/announce_begin_server.cpp | 2 +- src/core/thread/announce_sender.cpp | 4 +- src/core/thread/data_poll_manager.cpp | 12 +- src/core/thread/energy_scan_server.cpp | 4 +- src/core/thread/mesh_forwarder.cpp | 24 +- src/core/thread/mesh_forwarder_ftd.cpp | 18 +- src/core/thread/mle.cpp | 67 +- src/core/thread/mle_router.cpp | 54 +- src/core/thread/network_data.cpp | 8 +- src/core/thread/network_data_leader.cpp | 2 +- src/core/thread/network_data_leader_ftd.cpp | 30 +- src/core/thread/network_data_local.cpp | 12 +- src/core/thread/network_diagnostic.cpp | 30 +- src/core/thread/panid_query_server.cpp | 4 +- src/core/thread/router_table.cpp | 4 +- src/core/thread/src_match_controller.cpp | 21 +- src/core/utils/channel_manager.cpp | 60 +- src/core/utils/channel_monitor.cpp | 9 +- src/core/utils/child_supervision.cpp | 8 +- src/core/utils/jam_detector.cpp | 12 +- src/ncp/ncp_base.cpp | 5 +- src/posix/platform/radio_spinel.cpp | 49 +- 64 files changed, 1159 insertions(+), 1303 deletions(-) create mode 100644 include/openthread/logging.h create mode 100644 src/core/api/logging_api.cpp diff --git a/Android.mk b/Android.mk index 8941a3339..1fe5d216a 100644 --- a/Android.mk +++ b/Android.mk @@ -77,6 +77,7 @@ LOCAL_SRC_FILES := \ src/core/api/joiner_api.cpp \ src/core/api/link_api.cpp \ src/core/api/link_raw_api.cpp \ + src/core/api/logging_api.cpp \ src/core/api/message_api.cpp \ src/core/api/netdata_api.cpp \ src/core/api/server_api.cpp \ diff --git a/etc/visual-studio/libopenthread.vcxproj b/etc/visual-studio/libopenthread.vcxproj index 4f0727bda..37f8b1e9d 100644 --- a/etc/visual-studio/libopenthread.vcxproj +++ b/etc/visual-studio/libopenthread.vcxproj @@ -67,6 +67,7 @@ + diff --git a/etc/visual-studio/libopenthread.vcxproj.filters b/etc/visual-studio/libopenthread.vcxproj.filters index 2af37200b..20c81ee8f 100644 --- a/etc/visual-studio/libopenthread.vcxproj.filters +++ b/etc/visual-studio/libopenthread.vcxproj.filters @@ -102,6 +102,9 @@ Source Files\api + + Source Files\api + Source Files\api diff --git a/examples/platforms/cc2538/radio.c b/examples/platforms/cc2538/radio.c index d7e8a11e0..bbb954048 100644 --- a/examples/platforms/cc2538/radio.c +++ b/examples/platforms/cc2538/radio.c @@ -106,7 +106,7 @@ void enableReceiver(void) { if (!sIsReceiverEnabled) { - otLogInfoPlat(sInstance, "Enabling receiver", NULL); + otLogInfoPlat("Enabling receiver", NULL); // flush rxfifo HWREG(RFCORE_SFR_RFST) = RFCORE_SFR_RFST_INSTR_FLUSHRX; @@ -122,7 +122,7 @@ void disableReceiver(void) { if (sIsReceiverEnabled) { - otLogInfoPlat(sInstance, "Disabling receiver", NULL); + otLogInfoPlat("Disabling receiver", NULL); while (HWREG(RFCORE_XREG_FSMSTAT1) & RFCORE_XREG_FSMSTAT1_TX_ACTIVE) ; @@ -153,7 +153,7 @@ void setChannel(uint8_t aChannel) enabled = true; } - otLogInfoPlat(sInstance, "Channel=%d", aChannel); + otLogInfoPlat("Channel=%d", aChannel); HWREG(RFCORE_XREG_FREQCTRL) = 11 + (aChannel - 11) * 5; sChannel = aChannel; @@ -171,7 +171,7 @@ void setTxPower(int8_t aTxPower) if (sTxPower != aTxPower) { - otLogInfoPlat(sInstance, "TxPower=%d", aTxPower); + otLogInfoPlat("TxPower=%d", aTxPower); for (i = sizeof(sTxPowerTable) / sizeof(TxPowerTable) - 1; i > 0; i--) { @@ -219,7 +219,7 @@ void otPlatRadioSetPanId(otInstance *aInstance, uint16_t aPanid) { (void)aInstance; - otLogInfoPlat(sInstance, "PANID=%X", aPanid); + otLogInfoPlat("PANID=%X", aPanid); HWREG(RFCORE_FFSM_PAN_ID0) = aPanid & 0xFF; HWREG(RFCORE_FFSM_PAN_ID1) = aPanid >> 8; @@ -229,8 +229,8 @@ void otPlatRadioSetExtendedAddress(otInstance *aInstance, const otExtAddress *aA { (void)aInstance; - otLogInfoPlat(sInstance, "ExtAddr=%X%X%X%X%X%X%X%X", aAddress->m8[7], aAddress->m8[6], aAddress->m8[5], - aAddress->m8[4], aAddress->m8[3], aAddress->m8[2], aAddress->m8[1], aAddress->m8[0]); + otLogInfoPlat("ExtAddr=%X%X%X%X%X%X%X%X", aAddress->m8[7], aAddress->m8[6], aAddress->m8[5], aAddress->m8[4], + aAddress->m8[3], aAddress->m8[2], aAddress->m8[1], aAddress->m8[0]); for (int i = 0; i < 8; i++) { @@ -242,7 +242,7 @@ void otPlatRadioSetShortAddress(otInstance *aInstance, uint16_t aAddress) { (void)aInstance; - otLogInfoPlat(sInstance, "ShortAddr=%X", aAddress); + otLogInfoPlat("ShortAddr=%X", aAddress); HWREG(RFCORE_FFSM_SHORT_ADDR0) = aAddress & 0xFF; HWREG(RFCORE_FFSM_SHORT_ADDR1) = aAddress >> 8; @@ -276,7 +276,7 @@ void cc2538RadioInit(void) HWREG(RFCORE_XREG_TXPOWER) = sTxPowerTable[0].mTxPowerReg; sTxPower = sTxPowerTable[0].mTxPowerVal; - otLogInfoPlat(sInstance, "Initialized", NULL); + otLogInfoPlat("Initialized", NULL); } bool otPlatRadioIsEnabled(otInstance *aInstance) @@ -289,7 +289,7 @@ otError otPlatRadioEnable(otInstance *aInstance) { if (!otPlatRadioIsEnabled(aInstance)) { - otLogDebgPlat(sInstance, "State=OT_RADIO_STATE_SLEEP", NULL); + otLogDebgPlat("State=OT_RADIO_STATE_SLEEP", NULL); sState = OT_RADIO_STATE_SLEEP; } @@ -300,7 +300,7 @@ otError otPlatRadioDisable(otInstance *aInstance) { if (otPlatRadioIsEnabled(aInstance)) { - otLogDebgPlat(sInstance, "State=OT_RADIO_STATE_DISABLED", NULL); + otLogDebgPlat("State=OT_RADIO_STATE_DISABLED", NULL); sState = OT_RADIO_STATE_DISABLED; } @@ -314,7 +314,7 @@ otError otPlatRadioSleep(otInstance *aInstance) if (sState == OT_RADIO_STATE_SLEEP || sState == OT_RADIO_STATE_RECEIVE) { - otLogDebgPlat(sInstance, "State=OT_RADIO_STATE_SLEEP", NULL); + otLogDebgPlat("State=OT_RADIO_STATE_SLEEP", NULL); error = OT_ERROR_NONE; sState = OT_RADIO_STATE_SLEEP; disableReceiver(); @@ -330,7 +330,7 @@ otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel) if (sState != OT_RADIO_STATE_DISABLED) { - otLogDebgPlat(sInstance, "State=OT_RADIO_STATE_RECEIVE", NULL); + otLogDebgPlat("State=OT_RADIO_STATE_RECEIVE", NULL); error = OT_ERROR_NONE; sState = OT_RADIO_STATE_RECEIVE; @@ -395,7 +395,7 @@ otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame) } else { - otLogCritPlat(sInstance, "Radio is stuck!!! FSMSTAT0=0x%08x FSMSTAT1=0x%08x RFERRF=0x%08x", + otLogCritPlat("Radio is stuck!!! FSMSTAT0=0x%08x FSMSTAT1=0x%08x RFERRF=0x%08x", HWREG(RFCORE_XREG_FSMSTAT0), HWREG(RFCORE_XREG_FSMSTAT1), HWREG(RFCORE_SFR_RFERRF)); i = 1000000; } @@ -407,12 +407,12 @@ otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame) { if (HWREG(RFCORE_SFR_RFERRF) & RFCORE_SFR_RFERRF_RXOVERF) { - otLogCritPlat(sInstance, "RX Buffer Overflow detected", NULL); + otLogCritPlat("RX Buffer Overflow detected", NULL); } if (HWREG(RFCORE_SFR_RFERRF) & RFCORE_SFR_RFERRF_RXABO) { - otLogCritPlat(sInstance, "Aborted RX detected", NULL); + otLogCritPlat("Aborted RX detected", NULL); } // Flush the RX buffer @@ -423,7 +423,7 @@ otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame) // Check for idle state. After flushing the RX buffer, we may wind up here. if (!(HWREG(RFCORE_XREG_FSMSTAT1) & (RFCORE_XREG_FSMSTAT1_TX_ACTIVE | RFCORE_XREG_FSMSTAT1_RX_ACTIVE))) { - otLogCritPlat(sInstance, "Idle state detected", NULL); + otLogCritPlat("Idle state detected", NULL); // In this case, the state of our driver mis-matches our state. So force // matters by clearing our channel variable and calling setChannel. This @@ -450,7 +450,7 @@ otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame) while (HWREG(RFCORE_XREG_FSMSTAT1) & RFCORE_XREG_FSMSTAT1_TX_ACTIVE) ; - otLogDebgPlat(sInstance, "Transmitted %d bytes", aFrame->mLength); + otLogDebgPlat("Transmitted %d bytes", aFrame->mLength); } exit: @@ -485,7 +485,7 @@ void otPlatRadioSetPromiscuous(otInstance *aInstance, bool aEnable) { (void)aInstance; - otLogInfoPlat(sInstance, "PromiscuousMode=%d", aEnable ? 1 : 0); + otLogInfoPlat("PromiscuousMode=%d", aEnable ? 1 : 0); if (aEnable) { @@ -537,7 +537,7 @@ void readFrame(otInstance *aInstance) HWREG(RFCORE_SFR_RFST) = RFCORE_SFR_RFST_INSTR_FLUSHRX; HWREG(RFCORE_SFR_RFST) = RFCORE_SFR_RFST_INSTR_FLUSHRX; - otLogDebgPlat(sInstance, "Dropping %d received bytes (Invalid CRC)", length); + otLogDebgPlat("Dropping %d received bytes (Invalid CRC)", length); } // check for rxfifo overflow @@ -573,7 +573,7 @@ void cc2538RadioProcess(otInstance *aInstance) if (((HWREG(RFCORE_XREG_FRMFILT0) & RFCORE_XREG_FRMFILT0_FRAME_FILTER_EN) == 0) || (sReceiveFrame.mLength > IEEE802154_ACK_LENGTH)) { - otLogDebgPlat(sInstance, "Received %d bytes", sReceiveFrame.mLength); + otLogDebgPlat("Received %d bytes", sReceiveFrame.mLength); otPlatRadioReceiveDone(aInstance, &sReceiveFrame, sReceiveError); } } @@ -585,7 +585,7 @@ void cc2538RadioProcess(otInstance *aInstance) { if (sTransmitError != OT_ERROR_NONE) { - otLogDebgPlat(sInstance, "Transmit failed ErrorCode=%d", sTransmitError); + otLogDebgPlat("Transmit failed ErrorCode=%d", sTransmitError); } sState = OT_RADIO_STATE_RECEIVE; @@ -734,8 +734,8 @@ int8_t findSrcMatchAvailEntry(bool aShort) uint32_t shortEnableStatus = getSrcMatchEntriesEnableStatus(true); uint32_t extEnableStatus = getSrcMatchEntriesEnableStatus(false); - otLogDebgPlat(sInstance, "Short enable status: 0x%x", shortEnableStatus); - otLogDebgPlat(sInstance, "Ext enable status: 0x%x", extEnableStatus); + otLogDebgPlat("Short enable status: 0x%x", shortEnableStatus); + otLogDebgPlat("Ext enable status: 0x%x", extEnableStatus); if (aShort) { @@ -784,7 +784,7 @@ void otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable) { (void)aInstance; - otLogInfoPlat(sInstance, "EnableSrcMatch=%d", aEnable ? 1 : 0); + otLogInfoPlat("EnableSrcMatch=%d", aEnable ? 1 : 0); if (aEnable) { @@ -806,7 +806,7 @@ otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, const uint16_t a uint32_t *addr = (uint32_t *)RFCORE_FFSM_SRCADDRESS_TABLE; (void)aInstance; - otLogDebgPlat(sInstance, "Add ShortAddr entry: %d", entry); + otLogDebgPlat("Add ShortAddr entry: %d", entry); otEXPECT_ACTION(entry >= 0, error = OT_ERROR_NO_BUFS); @@ -830,7 +830,7 @@ otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress uint32_t *addr = (uint32_t *)RFCORE_FFSM_SRCADDRESS_TABLE; (void)aInstance; - otLogDebgPlat(sInstance, "Add ExtAddr entry: %d", entry); + otLogDebgPlat("Add ExtAddr entry: %d", entry); otEXPECT_ACTION(entry >= 0, error = OT_ERROR_NO_BUFS); @@ -853,7 +853,7 @@ otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, const uint16_t int8_t entry = findSrcMatchShortEntry(aShortAddress); (void)aInstance; - otLogDebgPlat(sInstance, "Clear ShortAddr entry: %d", entry); + otLogDebgPlat("Clear ShortAddr entry: %d", entry); otEXPECT_ACTION(entry >= 0, error = OT_ERROR_NO_ADDRESS); @@ -869,7 +869,7 @@ otError otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance, const otExtAddre int8_t entry = findSrcMatchExtEntry(aExtAddress); (void)aInstance; - otLogDebgPlat(sInstance, "Clear ExtAddr entry: %d", entry); + otLogDebgPlat("Clear ExtAddr entry: %d", entry); otEXPECT_ACTION(entry >= 0, error = OT_ERROR_NO_ADDRESS); @@ -885,7 +885,7 @@ void otPlatRadioClearSrcMatchShortEntries(otInstance *aInstance) uint32_t *addrAutoPendEn = (uint32_t *)RFCORE_FFSM_SRCSHORTPENDEN0; (void)aInstance; - otLogDebgPlat(sInstance, "Clear ShortAddr entries", NULL); + otLogDebgPlat("Clear ShortAddr entries", NULL); for (uint8_t i = 0; i < RFCORE_XREG_SRCMATCH_ENABLE_STATUS_SIZE; i++) { @@ -900,7 +900,7 @@ void otPlatRadioClearSrcMatchExtEntries(otInstance *aInstance) uint32_t *addrAutoPendEn = (uint32_t *)RFCORE_FFSM_SRCEXTPENDEN0; (void)aInstance; - otLogDebgPlat(sInstance, "Clear ExtAddr entries", NULL); + otLogDebgPlat("Clear ExtAddr entries", NULL); for (uint8_t i = 0; i < RFCORE_XREG_SRCMATCH_ENABLE_STATUS_SIZE; i++) { diff --git a/examples/platforms/da15000/radio.c b/examples/platforms/da15000/radio.c index 2f54791ce..cafb2f51d 100644 --- a/examples/platforms/da15000/radio.c +++ b/examples/platforms/da15000/radio.c @@ -152,22 +152,22 @@ void otPlatRadioGetIeeeEui64(otInstance *aInstance, uint8_t *aIeeeEui64) void otPlatRadioSetPanId(otInstance *aInstance, uint16_t aPanid) { - otLogInfoPlat(aInstance, "Set PanId: %X", aPanid); + otLogInfoPlat("Set PanId: %X", aPanid); ftdf_set_value(FTDF_PIB_PAN_ID, &aPanid); } void otPlatRadioSetExtendedAddress(otInstance *aInstance, const otExtAddress *aAddress) { - otLogInfoPlat(aInstance, "Set Extended Address: %X%X%X%X%X%X%X%X", aAddress->m8[7], aAddress->m8[6], - aAddress->m8[5], aAddress->m8[4], aAddress->m8[3], aAddress->m8[2], aAddress->m8[1], aAddress->m8[0]); + otLogInfoPlat("Set Extended Address: %X%X%X%X%X%X%X%X", aAddress->m8[7], aAddress->m8[6], aAddress->m8[5], + aAddress->m8[4], aAddress->m8[3], aAddress->m8[2], aAddress->m8[1], aAddress->m8[0]); ftdf_set_value(FTDF_PIB_EXTENDED_ADDRESS, aAddress->m8); } void otPlatRadioSetShortAddress(otInstance *aInstance, uint16_t aAddress) { - otLogInfoPlat(aInstance, "Set Short Address: %X", aAddress); + otLogInfoPlat("Set Short Address: %X", aAddress); ftdf_set_value(FTDF_PIB_SHORT_ADDRESS, &aAddress); } @@ -197,7 +197,7 @@ otError otPlatRadioEnable(otInstance *aInstance) ftdf_enable_transparent_mode(FTDF_TRUE, options); otPlatRadioSetPromiscuous(aInstance, false); - otLogDebgPlat(aInstance, "Radio state: OT_RADIO_STATE_SLEEP", NULL); + otLogDebgPlat("Radio state: OT_RADIO_STATE_SLEEP", NULL); sRadioState = OT_RADIO_STATE_SLEEP; exit: @@ -212,7 +212,7 @@ otError otPlatRadioDisable(otInstance *aInstance) ftdf_fppr_reset(); - otLogDebgPlat(aInstance, "Radio state: OT_RADIO_STATE_DISABLED", NULL); + otLogDebgPlat("Radio state: OT_RADIO_STATE_DISABLED", NULL); sRadioState = OT_RADIO_STATE_DISABLED; return OT_ERROR_NONE; @@ -241,7 +241,7 @@ otError otPlatRadioSleep(otInstance *aInstance) otEXPECT_ACTION(sRadioState == OT_RADIO_STATE_RECEIVE, error = OT_ERROR_INVALID_STATE); - otLogDebgPlat(aInstance, "Radio state: OT_RADIO_STATE_SLEEP", NULL); + otLogDebgPlat("Radio state: OT_RADIO_STATE_SLEEP", NULL); sRadioState = OT_RADIO_STATE_SLEEP; sEnableRX = 0; @@ -269,7 +269,7 @@ otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel) sEnableRX = 1; ftdf_set_value(FTDF_PIB_RX_ON_WHEN_IDLE, &sEnableRX); - otLogDebgPlat(aInstance, "Radio state: OT_RADIO_STATE_RECEIVE", NULL); + otLogDebgPlat("Radio state: OT_RADIO_STATE_RECEIVE", NULL); sRadioState = OT_RADIO_STATE_RECEIVE; exit: @@ -293,7 +293,7 @@ otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, const uint16_t a otEXPECT_ACTION(ftdf_fppr_get_free_short_address(&entry, &entryIdx), error = OT_ERROR_NO_BUFS); - otLogDebgPlat(aInstance, "Add ShortAddress entry: %d", entry); + otLogDebgPlat("Add ShortAddress entry: %d", entry); ftdf_fppr_set_short_address(entry, entryIdx, aShortAddress); ftdf_fppr_set_short_address_valid(entry, entryIdx, FTDF_TRUE); @@ -321,7 +321,7 @@ otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress otEXPECT_ACTION(ftdf_fppr_get_free_ext_address(&entry), error = OT_ERROR_NO_BUFS); - otLogDebgPlat(aInstance, "Add ExtAddress entry: %d", entry); + otLogDebgPlat("Add ExtAddress entry: %d", entry); ftdf_fppr_set_ext_address(entry, addr); ftdf_fppr_set_ext_address_valid(entry, FTDF_TRUE); @@ -338,7 +338,7 @@ otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, const uint16_t otEXPECT_ACTION(ftdf_fppr_lookup_short_address(aShortAddress, &entry, &entryIdx), error = OT_ERROR_NO_ADDRESS); - otLogDebgPlat(aInstance, "Clear ShortAddress entry: %d", entry); + otLogDebgPlat("Clear ShortAddress entry: %d", entry); ftdf_fppr_set_short_address(entry, entryIdx, 0); ftdf_fppr_set_short_address_valid(entry, entryIdx, FTDF_FALSE); @@ -363,7 +363,7 @@ otError otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance, const otExtAddre otEXPECT_ACTION(ftdf_fppr_lookup_ext_address(addr, &entry), error = OT_ERROR_NO_ADDRESS); - otLogDebgPlat(aInstance, "Clear ExtAddress entry: %d", entry); + otLogDebgPlat("Clear ExtAddress entry: %d", entry); ftdf_fppr_set_ext_address(entry, 0); ftdf_fppr_set_ext_address_valid(entry, FTDF_FALSE); @@ -376,7 +376,7 @@ void otPlatRadioClearSrcMatchShortEntries(otInstance *aInstance) { uint8_t i, j; - otLogDebgPlat(aInstance, "Clear ShortAddress entries", NULL); + otLogDebgPlat("Clear ShortAddress entries", NULL); for (i = 0; i < FTDF_FPPR_TABLE_ENTRIES; i++) { @@ -394,7 +394,7 @@ void otPlatRadioClearSrcMatchExtEntries(otInstance *aInstance) { uint8_t i; - otLogDebgPlat(aInstance, "Clear ExtAddress entries", NULL); + otLogDebgPlat("Clear ExtAddress entries", NULL); for (i = 0; i < FTDF_FPPR_TABLE_ENTRIES; i++) { @@ -418,11 +418,11 @@ otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame) otEXPECT_ACTION(sRadioState != OT_RADIO_STATE_DISABLED, error = OT_ERROR_INVALID_STATE); - otLogDebgPlat(aInstance, "Radio start transmit: %d bytes on channel: %d", aFrame->mLength, aFrame->mChannel); + otLogDebgPlat("Radio start transmit: %d bytes on channel: %d", aFrame->mLength, aFrame->mChannel); ad_ftdf_send_frame_simple(aFrame->mLength, aFrame->mPsdu, aFrame->mChannel, 0, FTDF_TRUE); - otLogDebgPlat(aInstance, "Radio state: OT_RADIO_STATE_TRANSMIT", NULL); + otLogDebgPlat("Radio state: OT_RADIO_STATE_TRANSMIT", NULL); sRadioState = OT_RADIO_STATE_TRANSMIT; otPlatRadioTxStarted(aInstance, aFrame); @@ -454,7 +454,7 @@ bool otPlatRadioGetPromiscuous(otInstance *aInstance) void otPlatRadioSetPromiscuous(otInstance *aInstance, bool aEnable) { - otLogInfoPlat(aInstance, "Set Promiscuous: %d", aEnable ? 1 : 0); + otLogInfoPlat("Set Promiscuous: %d", aEnable ? 1 : 0); ftdf_set_value(FTDF_PIB_PROMISCUOUS_MODE, &aEnable); sRadioPromiscuous = aEnable; @@ -483,7 +483,7 @@ exit: otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower) { - otLogInfoPlat(aInstance, "Set DefaultTxPower: %d", aPower); + otLogInfoPlat("Set DefaultTxPower: %d", aPower); sTxPower = aPower; ftdf_set_value(FTDF_PIB_TX_POWER, &aPower); @@ -499,7 +499,7 @@ void da15000RadioProcess(otInstance *aInstance) { ftdf_get_frame_header(sReceiveFrame[sReadFrame].mPsdu, &frameHeader); - otLogDebgPlat(aInstance, "Radio received: %d bytes", sReceiveFrame[sReadFrame].mLength); + otLogDebgPlat("Radio received: %d bytes", sReceiveFrame[sReadFrame].mLength); if (frameHeader.frame_type == FTDF_ACKNOWLEDGEMENT_FRAME) { @@ -515,7 +515,7 @@ void da15000RadioProcess(otInstance *aInstance) if (sTransmitDoneFrame) { - otLogDebgPlat(aInstance, "Radio transmit status: %s", otThreadErrorToString(sTransmitStatus)); + otLogDebgPlat("Radio transmit status: %s", otThreadErrorToString(sTransmitStatus)); ftdf_get_frame_header(sTransmitFrame.mPsdu, &frameHeader); @@ -534,7 +534,7 @@ void da15000RadioProcess(otInstance *aInstance) sTransmitDoneFrame = false; - otLogDebgPlat(aInstance, "Radio state: OT_RADIO_STATE_RECEIVE", NULL); + otLogDebgPlat("Radio state: OT_RADIO_STATE_RECEIVE", NULL); } exit: diff --git a/examples/platforms/efr32/radio.c b/examples/platforms/efr32/radio.c index ddf8de29a..5eb2839a0 100644 --- a/examples/platforms/efr32/radio.c +++ b/examples/platforms/efr32/radio.c @@ -192,7 +192,7 @@ void efr32RadioInit(void) sTransmitFrame.mLength = 0; sTransmitFrame.mPsdu = sTransmitPsdu; - otLogInfoPlat(sInstance, "Initialized", NULL); + otLogInfoPlat("Initialized", NULL); } void efr32RadioDeinit(void) @@ -226,7 +226,7 @@ void otPlatRadioSetPanId(otInstance *aInstance, uint16_t aPanId) (void)aInstance; - otLogInfoPlat(sInstance, "PANID=%X", aPanId); + otLogInfoPlat("PANID=%X", aPanId); sPanId = aPanId; status = RAIL_IEEE802154_SetPanId(sRailHandle, aPanId, 0); @@ -239,8 +239,8 @@ void otPlatRadioSetExtendedAddress(otInstance *aInstance, const otExtAddress *aA (void)aInstance; - otLogInfoPlat(sInstance, "ExtAddr=%X%X%X%X%X%X%X%X", aAddress->m8[7], aAddress->m8[6], aAddress->m8[5], - aAddress->m8[4], aAddress->m8[3], aAddress->m8[2], aAddress->m8[1], aAddress->m8[0]); + otLogInfoPlat("ExtAddr=%X%X%X%X%X%X%X%X", aAddress->m8[7], aAddress->m8[6], aAddress->m8[5], aAddress->m8[4], + aAddress->m8[3], aAddress->m8[2], aAddress->m8[1], aAddress->m8[0]); status = RAIL_IEEE802154_SetLongAddress(sRailHandle, (uint8_t *)aAddress->m8, 0); assert(status == RAIL_STATUS_NO_ERROR); @@ -252,7 +252,7 @@ void otPlatRadioSetShortAddress(otInstance *aInstance, uint16_t aAddress) (void)aInstance; - otLogInfoPlat(sInstance, "ShortAddr=%X", aAddress); + otLogInfoPlat("ShortAddr=%X", aAddress); status = RAIL_IEEE802154_SetShortAddress(sRailHandle, aAddress, 0); assert(status == RAIL_STATUS_NO_ERROR); @@ -268,7 +268,7 @@ otError otPlatRadioEnable(otInstance *aInstance) { otEXPECT(!otPlatRadioIsEnabled(aInstance)); - otLogInfoPlat(sInstance, "State=OT_RADIO_STATE_SLEEP", NULL); + otLogInfoPlat("State=OT_RADIO_STATE_SLEEP", NULL); sState = OT_RADIO_STATE_SLEEP; exit: @@ -279,7 +279,7 @@ otError otPlatRadioDisable(otInstance *aInstance) { otEXPECT(otPlatRadioIsEnabled(aInstance)); - otLogInfoPlat(sInstance, "State=OT_RADIO_STATE_DISABLED", NULL); + otLogInfoPlat("State=OT_RADIO_STATE_DISABLED", NULL); sState = OT_RADIO_STATE_DISABLED; exit: @@ -294,7 +294,7 @@ otError otPlatRadioSleep(otInstance *aInstance) otEXPECT_ACTION((sState != OT_RADIO_STATE_TRANSMIT) && (sState != OT_RADIO_STATE_DISABLED), error = OT_ERROR_INVALID_STATE); - otLogInfoPlat(sInstance, "State=OT_RADIO_STATE_SLEEP", NULL); + otLogInfoPlat("State=OT_RADIO_STATE_SLEEP", NULL); sState = OT_RADIO_STATE_SLEEP; RAIL_Idle(sRailHandle, RAIL_IDLE, true); @@ -314,7 +314,7 @@ otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel) status = RAIL_StartRx(sRailHandle, aChannel, NULL); otEXPECT_ACTION(status == RAIL_STATUS_NO_ERROR, error = OT_ERROR_FAILED); - otLogInfoPlat(sInstance, "State=OT_RADIO_STATE_RECEIVE", NULL); + otLogInfoPlat("State=OT_RADIO_STATE_RECEIVE", NULL); sState = OT_RADIO_STATE_RECEIVE; sReceiveFrame.mChannel = aChannel; @@ -513,7 +513,7 @@ otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, const uint16_t a int8_t entry = -1; entry = findSrcMatchAvailEntry(true); - otLogDebgPlat(sInstance, "Add ShortAddr entry: %d", entry); + otLogDebgPlat("Add ShortAddr entry: %d", entry); otEXPECT_ACTION(entry >= 0 && entry < RADIO_CONFIG_SRC_MATCH_SHORT_ENTRY_NUM, error = OT_ERROR_NO_BUFS); @@ -530,7 +530,7 @@ otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress (void)aInstance; entry = findSrcMatchAvailEntry(false); - otLogDebgPlat(sInstance, "Add ExtAddr entry: %d", entry); + otLogDebgPlat("Add ExtAddr entry: %d", entry); otEXPECT_ACTION(entry >= 0 && entry < RADIO_CONFIG_SRC_MATCH_EXT_ENTRY_NUM, error = OT_ERROR_NO_BUFS); @@ -547,7 +547,7 @@ otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, const uint16_t (void)aInstance; entry = findSrcMatchShortEntry(aShortAddress); - otLogDebgPlat(sInstance, "Clear ShortAddr entry: %d", entry); + otLogDebgPlat("Clear ShortAddr entry: %d", entry); otEXPECT_ACTION(entry >= 0 && entry < RADIO_CONFIG_SRC_MATCH_SHORT_ENTRY_NUM, error = OT_ERROR_NO_ADDRESS); @@ -564,7 +564,7 @@ otError otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance, const otExtAddre (void)aInstance; entry = findSrcMatchExtEntry(aExtAddress); - otLogDebgPlat(sInstance, "Clear ExtAddr entry: %d", entry); + otLogDebgPlat("Clear ExtAddr entry: %d", entry); otEXPECT_ACTION(entry >= 0 && entry < RADIO_CONFIG_SRC_MATCH_EXT_ENTRY_NUM, error = OT_ERROR_NO_ADDRESS); @@ -578,7 +578,7 @@ void otPlatRadioClearSrcMatchShortEntries(otInstance *aInstance) { (void)aInstance; - otLogDebgPlat(sInstance, "Clear ShortAddr entries", NULL); + otLogDebgPlat("Clear ShortAddr entries", NULL); memset(srcMatchShortEntry, 0, sizeof(srcMatchShortEntry)); } @@ -587,7 +587,7 @@ void otPlatRadioClearSrcMatchExtEntries(otInstance *aInstance) { (void)aInstance; - otLogDebgPlat(sInstance, "Clear ExtAddr entries", NULL); + otLogDebgPlat("Clear ExtAddr entries", NULL); memset(srcMatchExtEntry, 0, sizeof(srcMatchExtEntry)); } @@ -617,7 +617,7 @@ static void processNextRxPacket(otInstance *aInstance, RAIL_Handle_t aRailHandle // check the length validity of recv packet otEXPECT(length >= IEEE802154_MIN_LENGTH && length <= IEEE802154_MAX_LENGTH); - otLogInfoPlat(aInstance, "Received data:%d", length); + otLogInfoPlat("Received data:%d", length); // skip length byte assert(packetInfo.firstPortionBytes > 0); @@ -673,7 +673,7 @@ static void processNextRxPacket(otInstance *aInstance, RAIL_Handle_t aRailHandle // otherwise only signal MAC layer for non-ACK frame if (sPromiscuous || sReceiveFrame.mLength > IEEE802154_ACK_LENGTH) { - otLogInfoPlat(aInstance, "Received %d bytes", sReceiveFrame.mLength); + otLogInfoPlat("Received %d bytes", sReceiveFrame.mLength); otPlatRadioReceiveDone(aInstance, &sReceiveFrame, sReceiveError); } } @@ -776,7 +776,7 @@ void efr32RadioProcess(otInstance *aInstance) { if (sTransmitError != OT_ERROR_NONE) { - otLogDebgPlat(sInstance, "Transmit failed ErrorCode=%d", sTransmitError); + otLogDebgPlat("Transmit failed ErrorCode=%d", sTransmitError); } sState = OT_RADIO_STATE_RECEIVE; diff --git a/examples/platforms/samr21/radio.c b/examples/platforms/samr21/radio.c index 6692fc2fc..0f73a8eb5 100644 --- a/examples/platforms/samr21/radio.c +++ b/examples/platforms/samr21/radio.c @@ -156,7 +156,7 @@ static void setTxPower(uint8_t aPower) } } - otLogDebgPlat(sInstance, "Radio set tx power: %d, %d", aPower, i); + otLogDebgPlat("Radio set tx power: %d, %d", aPower, i); radioTrxOff(); @@ -172,7 +172,7 @@ static void setChannel(uint8_t aChannel) { if (aChannel != sChannel) { - otLogDebgPlat(sInstance, "Radio set channel: %d", aChannel); + otLogDebgPlat("Radio set channel: %d", aChannel); radioTrxOff(); @@ -234,7 +234,7 @@ static void handleRx(void) // otherwise only signal MAC layer for non-ACK frame if (sPromiscuous || sReceiveFrame.mLength > IEEE802154_ACK_LENGTH) { - otLogDebgPlat(sInstance, "Radio receive done, rssi: %d", sReceiveFrame.mInfo.mRxInfo.mRssi); + otLogDebgPlat("Radio receive done, rssi: %d", sReceiveFrame.mInfo.mRxInfo.mRssi); otPlatRadioReceiveDone(sInstance, &sReceiveFrame, OT_ERROR_NONE); } @@ -257,7 +257,7 @@ static void handleTx(void) else #endif { - otLogDebgPlat(sInstance, "Radio transmit done, status: %d", sTxStatus); + otLogDebgPlat("Radio transmit done, status: %d", sTxStatus); otPlatRadioTxDone(sInstance, &sTransmitFrame, NULL, sTxStatus); } @@ -376,7 +376,7 @@ void otPlatRadioSetPanId(otInstance *aInstance, uint16_t aPanId) { (void)aInstance; - otLogDebgPlat(sInstance, "Set Pan ID: 0x%04X", aPanId); + otLogDebgPlat("Set Pan ID: 0x%04X", aPanId); radioTrxOff(); @@ -416,7 +416,7 @@ bool otPlatRadioIsEnabled(otInstance *aInstance) otError otPlatRadioEnable(otInstance *aInstance) { - otLogDebgPlat(sInstance, "Radio enable"); + otLogDebgPlat("Radio enable"); if (!otPlatRadioIsEnabled(aInstance)) { @@ -430,7 +430,7 @@ otError otPlatRadioEnable(otInstance *aInstance) otError otPlatRadioDisable(otInstance *aInstance) { - otLogDebgPlat(sInstance, "Radio disable"); + otLogDebgPlat("Radio disable"); if (otPlatRadioIsEnabled(aInstance)) { @@ -446,7 +446,7 @@ otError otPlatRadioSleep(otInstance *aInstance) { (void)aInstance; - otLogDebgPlat(sInstance, "Radio sleep"); + otLogDebgPlat("Radio sleep"); otError error = OT_ERROR_NONE; @@ -465,7 +465,7 @@ otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel) { (void)aInstance; - otLogDebgPlat(sInstance, "Radio receive, channel: %d", aChannel); + otLogDebgPlat("Radio receive, channel: %d", aChannel); otError error = OT_ERROR_NONE; @@ -486,7 +486,7 @@ otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame) { (void)aInstance; - otLogDebgPlat(sInstance, "Radio transmit"); + otLogDebgPlat("Radio transmit"); otError error = OT_ERROR_NONE; @@ -606,7 +606,7 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower) { (void)aInstance; - otLogDebgPlat(sInstance, "Radio set default TX power: %d", aPower); + otLogDebgPlat("Radio set default TX power: %d", aPower); setTxPower(aPower); diff --git a/include/openthread/Makefile.am b/include/openthread/Makefile.am index 5b54db7d8..044c72649 100644 --- a/include/openthread/Makefile.am +++ b/include/openthread/Makefile.am @@ -72,6 +72,7 @@ openthread_headers = \ joiner.h \ link.h \ link_raw.h \ + logging.h \ message.h \ ncp.h \ netdata.h \ diff --git a/include/openthread/instance.h b/include/openthread/instance.h index de843e632..7ef40b14c 100644 --- a/include/openthread/instance.h +++ b/include/openthread/instance.h @@ -356,29 +356,6 @@ OTAPI void OTCALL otInstanceFactoryReset(otInstance *aInstance); */ otError otInstanceErasePersistentInfo(otInstance *aInstance); -/** - * This function returns the current dynamic log level. - * - * @param[in] aInstance A pointer to an OpenThread instance. - * - * @returns the currently set dynamic log level. - * - */ -otLogLevel otGetDynamicLogLevel(otInstance *aInstance); - -/** - * This function sets the dynamic log level. - * - * @param[in] aInstance A pointer to an OpenThread instance. - * @param[in] aLogLevel The dynamic log level. - * - * @retval OT_ERROR_NONE The log level was changed successfully. - * @retval OT_ERROR_DISABLED_FEATURE The dynamic log level feature is disabled. - * (see `OPENTHREAD_CONFIG_ENABLE_DYNAMIC_LOG_LEVEL` configuration option). - * - */ -otError otSetDynamicLogLevel(otInstance *aInstance, otLogLevel aLogLevel); - /** * This function gets the OpenThread version string. * diff --git a/include/openthread/logging.h b/include/openthread/logging.h new file mode 100644 index 000000000..c4dc2c9e0 --- /dev/null +++ b/include/openthread/logging.h @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2016-2018, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * @brief + * This file includes OpenThread logging related definitions. + */ + +#ifndef OPENTHREAD_LOGGING_H_ +#define OPENTHREAD_LOGGING_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup api-logging + * + * @brief + * This module includes OpenThread logging related definitions. + * + * @{ + * + */ + +/** + * This function returns the current log level. + * + * If dynamic log level feature `OPENTHREAD_CONFIG_ENABLE_DYNAMIC_LOG_LEVEL` is enabled, this function returns the + * currently set dynamic log level. Otherwise, this function returns the build-time configured log level. + * + * @returns The log level. + * + */ +otLogLevel otLoggingGetLevel(void); + +/** + * This function sets the log level. + * + * @param[in] aLogLevel The log level. + * + * @retval OT_ERROR_NONE The log level was changed successfully. + * @retval OT_ERROR_DISABLED_FEATURE The dynamic log level feature is not supported. + * (see `OPENTHREAD_CONFIG_ENABLE_DYNAMIC_LOG_LEVEL` configuration option). + * + */ +otError otLoggingSetLevel(otLogLevel aLogLevel); + +/** + * @} + * + */ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // OPENTHREAD_LOGGING_H_ diff --git a/include/openthread/platform/logging-windows.h b/include/openthread/platform/logging-windows.h index 6269a7b0e..c4ac44df8 100644 --- a/include/openthread/platform/logging-windows.h +++ b/include/openthread/platform/logging-windows.h @@ -158,358 +158,358 @@ // ==API== // begin_wpp config -// USEPREFIX (otLogCritApi, "[%p]API%!SPACE!", &CTX); -// otLogCritApi{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_API}(CTX, MSG, ...); +// USEPREFIX (otLogCritApi, "API%!SPACE!"); +// otLogCritApi{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_API}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogWarnApi, "[%p]API%!SPACE!", &CTX); -// otLogWarnApi{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_API}(CTX, MSG, ...); +// USEPREFIX (otLogWarnApi, "API%!SPACE!"); +// otLogWarnApi{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_API}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogNoteApi, "[%p]API%!SPACE!", &CTX); -// otLogNoteApi{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_API}(CTX, MSG, ...); +// USEPREFIX (otLogNoteApi, "API%!SPACE!"); +// otLogNoteApi{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_API}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogInfoApi, "[%p]API%!SPACE!", &CTX); -// otLogInfoApi{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_API}(CTX, MSG, ...); +// USEPREFIX (otLogInfoApi, "API%!SPACE!"); +// otLogInfoApi{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_API}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogDebgApi, "[%p]API%!SPACE!", &CTX); -// otLogDebgApi{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_API}(CTX, MSG, ...); +// USEPREFIX (otLogDebgApi, "API%!SPACE!"); +// otLogDebgApi{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_API}(MSG, ...); // end_wpp // ==NCP== // begin_wpp config -// USEPREFIX (otLogCritNcp, "[%p]NCP%!SPACE!", &CTX); -// otLogCritNcp{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_NCP}(CTX, MSG, ...); +// USEPREFIX (otLogCritNcp, "NCP%!SPACE!"); +// otLogCritNcp{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_NCP}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogWarnNcp, "[%p]NCP%!SPACE!", &CTX); -// otLogWarnNcp{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_NCP}(CTX, MSG, ...); +// USEPREFIX (otLogWarnNcp, "NCP%!SPACE!"); +// otLogWarnNcp{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_NCP}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogNoteNcp, "[%p]NCP%!SPACE!", &CTX); -// otLogNoteNcp{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_NCP}(CTX, MSG, ...); +// USEPREFIX (otLogNoteNcp, "NCP%!SPACE!"); +// otLogNoteNcp{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_NCP}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogInfoNcp, "[%p]NCP%!SPACE!", &CTX); -// otLogInfoNcp{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_NCP}(CTX, MSG, ...); +// USEPREFIX (otLogInfoNcp, "NCP%!SPACE!"); +// otLogInfoNcp{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_NCP}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogDebgNcp, "[%p]NCP%!SPACE!", &CTX); -// otLogDebgNcp{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_NCP}(CTX, MSG, ...); +// USEPREFIX (otLogDebgNcp, "NCP%!SPACE!"); +// otLogDebgNcp{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_NCP}(MSG, ...); // end_wpp // ==MESHCOP== // begin_wpp config -// USEPREFIX (otLogCritMeshCoP, "[%p]MESHCOP%!SPACE!", &CTX); -// otLogCritMeshCoP{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_MESHCOP}(CTX, MSG, ...); +// USEPREFIX (otLogCritMeshCoP, "MESHCOP%!SPACE!"); +// otLogCritMeshCoP{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_MESHCOP}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogWarnMeshCoP, "[%p]MESHCOP%!SPACE!", &CTX); -// otLogWarnMeshCoP{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_MESHCOP}(CTX, MSG, ...); +// USEPREFIX (otLogWarnMeshCoP, "MESHCOP%!SPACE!"); +// otLogWarnMeshCoP{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_MESHCOP}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogNoteMeshCoP, "[%p]MESHCOP%!SPACE!", &CTX); -// otLogNoteMeshCoP{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_MESHCOP}(CTX, MSG, ...); +// USEPREFIX (otLogNoteMeshCoP, "MESHCOP%!SPACE!"); +// otLogNoteMeshCoP{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_MESHCOP}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogInfoMeshCoP, "[%p]MESHCOP%!SPACE!", &CTX); -// otLogInfoMeshCoP{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_MESHCOP}(CTX, MSG, ...); +// USEPREFIX (otLogInfoMeshCoP, "MESHCOP%!SPACE!"); +// otLogInfoMeshCoP{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_MESHCOP}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogDebgMeshCoP, "[%p]MESHCOP%!SPACE!", &CTX); -// otLogDebgMeshCoP{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_MESHCOP}(CTX, MSG, ...); +// USEPREFIX (otLogDebgMeshCoP, "MESHCOP%!SPACE!"); +// otLogDebgMeshCoP{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_MESHCOP}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogCertMeshCoP, "[%p]MESHCOP%!SPACE!", &CTX); -// otLogCertMeshCoP{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_MESHCOP}(CTX, MSG, ...); +// USEPREFIX (otLogCertMeshCoP, "MESHCOP%!SPACE!"); +// otLogCertMeshCoP{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_MESHCOP}(MSG, ...); // end_wpp // ==MBEDTLS== // begin_wpp config -// USEPREFIX (otLogCritMbedTls, "[%p]MBED%!SPACE!", &CTX); -// otLogCritMbedTls{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_MBEDTLS}(CTX, MSG, ...); +// USEPREFIX (otLogCritMbedTls, "MBED%!SPACE!"); +// otLogCritMbedTls{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_MBEDTLS}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogWarnMbedTls, "[%p]MBED%!SPACE!", &CTX); -// otLogWarnMbedTls{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_MBEDTLS}(CTX, MSG, ...); +// USEPREFIX (otLogWarnMbedTls, "MBED%!SPACE!"); +// otLogWarnMbedTls{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_MBEDTLS}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogNoteMbedTls, "[%p]MBED%!SPACE!", &CTX); -// otLogNoteMbedTls{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_MBEDTLS}(CTX, MSG, ...); +// USEPREFIX (otLogNoteMbedTls, "MBED%!SPACE!"); +// otLogNoteMbedTls{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_MBEDTLS}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogInfoMbedTls, "[%p]MBED%!SPACE!", &CTX); -// otLogInfoMbedTls{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_MBEDTLS}(CTX, MSG, ...); +// USEPREFIX (otLogInfoMbedTls, "MBED%!SPACE!"); +// otLogInfoMbedTls{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_MBEDTLS}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogDebgMbedTls, "[%p]MBED%!SPACE!", &CTX); -// otLogDebgMbedTls{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_MBEDTLS}(CTX, MSG, ...); +// USEPREFIX (otLogDebgMbedTls, "MBED%!SPACE!"); +// otLogDebgMbedTls{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_MBEDTLS}(MSG, ...); // end_wpp // ==MLE== // begin_wpp config -// USEPREFIX (otLogCritMle, "[%p]MLE%!SPACE!", &CTX); -// otLogCritMle{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_MLE}(CTX, MSG, ...); +// USEPREFIX (otLogCritMle, "MLE%!SPACE!"); +// otLogCritMle{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_MLE}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogWarnMle, "[%p]MLE%!SPACE!", &CTX); -// otLogWarnMle{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_MLE}(CTX, MSG, ...); +// USEPREFIX (otLogWarnMle, "MLE%!SPACE!"); +// otLogWarnMle{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_MLE}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogWarnMleErr, "[%p]MLE%!SPACE!", &CTX); -// otLogWarnMleErr{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_MLE}(CTX, EXP, MSG, ...); +// USEPREFIX (otLogWarnMleErr, "MLE%!SPACE!"); +// otLogWarnMleErr{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_MLE}(EXP, MSG, ...); // USESUFFIX(otLogWarnMleErr, ", %!otError!", EXP); // end_wpp // begin_wpp config -// USEPREFIX (otLogNoteMle, "[%p]MLE%!SPACE!", &CTX); -// otLogNoteMle{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_MLE}(CTX, MSG, ...); +// USEPREFIX (otLogNoteMle, "MLE%!SPACE!"); +// otLogNoteMle{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_MLE}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogInfoMle, "[%p]MLE%!SPACE!", &CTX); -// otLogInfoMle{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_MLE}(CTX, MSG, ...); +// USEPREFIX (otLogInfoMle, "MLE%!SPACE!"); +// otLogInfoMle{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_MLE}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogDebgMle, "[%p]MLE%!SPACE!", &CTX); -// otLogDebgMle{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_MLE}(CTX, MSG, ...); +// USEPREFIX (otLogDebgMle, "MLE%!SPACE!"); +// otLogDebgMle{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_MLE}(MSG, ...); // end_wpp // ==ARP== // begin_wpp config -// USEPREFIX (otLogCritArp, "[%p]ARP%!SPACE!", &CTX); -// otLogCritArp{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_ARP}(CTX, MSG, ...); +// USEPREFIX (otLogCritArp, "ARP%!SPACE!"); +// otLogCritArp{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_ARP}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogWarnArp, "[%p]ARP%!SPACE!", &CTX); -// otLogWarnArp{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_ARP}(CTX, MSG, ...); +// USEPREFIX (otLogWarnArp, "ARP%!SPACE!"); +// otLogWarnArp{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_ARP}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogNoteArp, "[%p]ARP%!SPACE!", &CTX); -// otLogNoteArp{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_ARP}(CTX, MSG, ...); +// USEPREFIX (otLogNoteArp, "ARP%!SPACE!"); +// otLogNoteArp{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_ARP}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogInfoArp, "[%p]ARP%!SPACE!", &CTX); -// otLogInfoArp{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_ARP}(CTX, MSG, ...); +// USEPREFIX (otLogInfoArp, "ARP%!SPACE!"); +// otLogInfoArp{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_ARP}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogDebgArp, "[%p]ARP%!SPACE!", &CTX); -// otLogDebgArp{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_ARP}(CTX, MSG, ...); +// USEPREFIX (otLogDebgArp, "ARP%!SPACE!"); +// otLogDebgArp{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_ARP}(MSG, ...); // end_wpp // ==NETD== // begin_wpp config -// USEPREFIX (otLogCritNetData, "[%p]NETD%!SPACE!", &CTX); -// otLogCritNetData{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_NETD}(CTX, MSG, ...); +// USEPREFIX (otLogCritNetData, "NETD%!SPACE!"); +// otLogCritNetData{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_NETD}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogWarnNetData, "[%p]NETD%!SPACE!", &CTX); -// otLogWarnNetData{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_NETD}(CTX, MSG, ...); +// USEPREFIX (otLogWarnNetData, "NETD%!SPACE!"); +// otLogWarnNetData{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_NETD}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogNoteNetData, "[%p]NETD%!SPACE!", &CTX); -// otLogNoteNetData{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_NETD}(CTX, MSG, ...); +// USEPREFIX (otLogNoteNetData, "NETD%!SPACE!"); +// otLogNoteNetData{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_NETD}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogInfoNetData, "[%p]NETD%!SPACE!", &CTX); -// otLogInfoNetData{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_NETD}(CTX, MSG, ...); +// USEPREFIX (otLogInfoNetData, "NETD%!SPACE!"); +// otLogInfoNetData{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_NETD}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogDebgNetData, "[%p]NETD%!SPACE!", &CTX); -// otLogDebgNetData{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_NETD}(CTX, MSG, ...); +// USEPREFIX (otLogDebgNetData, "NETD%!SPACE!"); +// otLogDebgNetData{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_NETD}(MSG, ...); // end_wpp // ==ICMP== // begin_wpp config -// USEPREFIX (otLogCritIcmp, "[%p]ICMP%!SPACE!", &CTX); -// otLogCritIcmp{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_ICMP}(CTX, MSG, ...); +// USEPREFIX (otLogCritIcmp, "ICMP%!SPACE!"); +// otLogCritIcmp{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_ICMP}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogWarnIcmp, "[%p]ICMP%!SPACE!", &CTX); -// otLogWarnIcmp{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_ICMP}(CTX, MSG, ...); +// USEPREFIX (otLogWarnIcmp, "ICMP%!SPACE!"); +// otLogWarnIcmp{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_ICMP}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogNoteIcmp, "[%p]ICMP%!SPACE!", &CTX); -// otLogNoteIcmp{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_ICMP}(CTX, MSG, ...); +// USEPREFIX (otLogNoteIcmp, "ICMP%!SPACE!"); +// otLogNoteIcmp{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_ICMP}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogInfoIcmp, "[%p]ICMP%!SPACE!", &CTX); -// otLogInfoIcmp{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_ICMP}(CTX, MSG, ...); +// USEPREFIX (otLogInfoIcmp, "ICMP%!SPACE!"); +// otLogInfoIcmp{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_ICMP}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogDebgIcmp, "[%p]ICMP%!SPACE!", &CTX); -// otLogDebgIcmp{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_ICMP}(CTX, MSG, ...); +// USEPREFIX (otLogDebgIcmp, "ICMP%!SPACE!"); +// otLogDebgIcmp{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_ICMP}(MSG, ...); // end_wpp // ==IPV6== // begin_wpp config -// USEPREFIX (otLogCritIp6, "[%p]IP6%!SPACE!", &CTX); -// otLogCritIp6{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_IPV6}(CTX, MSG, ...); +// USEPREFIX (otLogCritIp6, "IP6%!SPACE!"); +// otLogCritIp6{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_IPV6}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogWarnIp6, "[%p]IP6%!SPACE!", &CTX); -// otLogWarnIp6{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_IPV6}(CTX, MSG, ...); +// USEPREFIX (otLogWarnIp6, "IP6%!SPACE!"); +// otLogWarnIp6{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_IPV6}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogNoteIp6, "[%p]IP6%!SPACE!", &CTX); -// otLogNoteIp6{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_IPV6}(CTX, MSG, ...); +// USEPREFIX (otLogNoteIp6, "IP6%!SPACE!"); +// otLogNoteIp6{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_IPV6}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogInfoIp6, "[%p]IP6%!SPACE!", &CTX); -// otLogInfoIp6{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_IPV6}(CTX, MSG, ...); +// USEPREFIX (otLogInfoIp6, "IP6%!SPACE!"); +// otLogInfoIp6{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_IPV6}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogDebgIp6, "[%p]IP6%!SPACE!", &CTX); -// otLogDebgIp6{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_IPV6}(CTX, MSG, ...); +// USEPREFIX (otLogDebgIp6, "IP6%!SPACE!"); +// otLogDebgIp6{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_IPV6}(MSG, ...); // end_wpp // ==MAC== // begin_wpp config -// USEPREFIX (otLogCritMac, "[%p]MAC%!SPACE!", &CTX); -// otLogCritMac{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_MAC}(CTX, MSG, ...); +// USEPREFIX (otLogCritMac, "MAC%!SPACE!"); +// otLogCritMac{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_MAC}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogWarnMac, "[%p]MAC%!SPACE!", &CTX); -// otLogWarnMac{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_MAC}(CTX, MSG, ...); +// USEPREFIX (otLogWarnMac, "MAC%!SPACE!"); +// otLogWarnMac{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_MAC}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogNoteMac, "[%p]MAC%!SPACE!", &CTX); -// otLogNoteMac{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_MAC}(CTX, MSG, ...); +// USEPREFIX (otLogNoteMac, "MAC%!SPACE!"); +// otLogNoteMac{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_MAC}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogInfoMac, "[%p]MAC%!SPACE!", &CTX); -// otLogInfoMac{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_MAC}(CTX, MSG, ...); +// USEPREFIX (otLogInfoMac, "MAC%!SPACE!"); +// otLogInfoMac{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_MAC}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogDebgMac, "[%p]MAC%!SPACE!", &CTX); -// otLogDebgMac{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_MAC}(CTX, MSG, ...); +// USEPREFIX (otLogDebgMac, "MAC%!SPACE!"); +// otLogDebgMac{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_MAC}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogDebgMacErr, "[%p]MAC%!SPACE!", &CTX); -// otLogDebgMacErr{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_MAC}(CTX, EXP, MSG, ...); +// USEPREFIX (otLogDebgMacErr, "MAC%!SPACE!"); +// otLogDebgMacErr{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_MAC}(EXP, MSG, ...); // USESUFFIX(otLogDebgMacErr, ", %!otError!", EXP); // end_wpp // begin_wpp config -// USEPREFIX (otLogMac, "[%p]MAC%!SPACE!", &CTX); -// otLogMac{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_MAC}(CTX, EXP, MSG, ...); +// USEPREFIX (otLogMac, "MAC%!SPACE!"); +// otLogMac{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_MAC}(EXP, MSG, ...); // end_wpp // ==CORE== // begin_wpp config -// USEPREFIX (otLogCritCore, "[%p]CORE%!SPACE!", &CTX); -// otLogCritCore{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_MAC}(CTX, MSG, ...); +// USEPREFIX (otLogCritCore, "CORE%!SPACE!"); +// otLogCritCore{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_MAC}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogWarnCore, "[%p]CORE%!SPACE!", &CTX); -// otLogWarnCore{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_MAC}(CTX, MSG, ...); +// USEPREFIX (otLogWarnCore, "CORE%!SPACE!"); +// otLogWarnCore{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_MAC}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogNoteCore, "[%p]CORE%!SPACE!", &CTX); -// otLogNoteCore{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_MAC}(CTX, MSG, ...); +// USEPREFIX (otLogNoteCore, "CORE%!SPACE!"); +// otLogNoteCore{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_MAC}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogInfoCore, "[%p]CORE%!SPACE!", &CTX); -// otLogInfoCore{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_MAC}(CTX, MSG, ...); +// USEPREFIX (otLogInfoCore, "CORE%!SPACE!"); +// otLogInfoCore{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_MAC}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogDebgCore, "[%p]CORE%!SPACE!", &CTX); -// otLogDebgCore{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_MAC}(CTX, MSG, ...); +// USEPREFIX (otLogDebgCore, "CORE%!SPACE!"); +// otLogDebgCore{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_MAC}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogDebgCoreErr, "[%p]CORE%!SPACE!", &CTX); -// otLogDebgCoreErr{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_MAC}(CTX, EXP, MSG, ...); +// USEPREFIX (otLogDebgCoreErr, "CORE%!SPACE!"); +// otLogDebgCoreErr{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_MAC}(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, ...); +// USEPREFIX (otLogCritUtil, "UTIL%!SPACE!"); +// otLogCritUtil{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_MAC}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogWarnUtil, "[%p]UTIL%!SPACE!", &CTX); -// otLogWarnUtil{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_MAC}(CTX, MSG, ...); +// USEPREFIX (otLogWarnUtil, "UTIL%!SPACE!"); +// otLogWarnUtil{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_MAC}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogNoteUtil, "[%p]UTIL%!SPACE!", &CTX); -// otLogNoteUtil{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_MAC}(CTX, MSG, ...); +// USEPREFIX (otLogNoteUtil, "UTIL%!SPACE!"); +// otLogNoteUtil{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_MAC}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogInfoUtil, "[%p]UTIL%!SPACE!", &CTX); -// otLogInfoUtil{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_MAC}(CTX, MSG, ...); +// USEPREFIX (otLogInfoUtil, "UTIL%!SPACE!"); +// otLogInfoUtil{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_MAC}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogDebgUtil, "[%p]UTIL%!SPACE!", &CTX); -// otLogDebgUtil{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_MAC}(CTX, MSG, ...); +// USEPREFIX (otLogDebgUtil, "UTIL%!SPACE!"); +// otLogDebgUtil{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_MAC}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogDebgUtilErr, "[%p]UTIL%!SPACE!", &CTX); -// otLogDebgUtilErr{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_MAC}(CTX, EXP, MSG, ...); +// USEPREFIX (otLogDebgUtilErr, "UTIL%!SPACE!"); +// otLogDebgUtilErr{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_MAC}(EXP, MSG, ...); // USESUFFIX(otLogDebgUtilErr, ", %!otError!", EXP); // end_wpp @@ -517,28 +517,28 @@ // ==MEM== // begin_wpp config -// USEPREFIX (otLogCritMem, "[%p]MEM%!SPACE!", &CTX); -// otLogCritMem{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_MEM}(CTX, MSG, ...); +// USEPREFIX (otLogCritMem, "MEM%!SPACE!"); +// otLogCritMem{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_MEM}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogWarnMem, "[%p]MEM%!SPACE!", &CTX); -// otLogWarnMem{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_MEM}(CTX, MSG, ...); +// USEPREFIX (otLogWarnMem, "MEM%!SPACE!"); +// otLogWarnMem{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_MEM}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogNoteMem, "[%p]MEM%!SPACE!", &CTX); -// otLogNoteMem{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_MEM}(CTX, MSG, ...); +// USEPREFIX (otLogNoteMem, "MEM%!SPACE!"); +// otLogNoteMem{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_MEM}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogInfoMem, "[%p]MEM%!SPACE!", &CTX); -// otLogInfoMem{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_MEM}(CTX, MSG, ...); +// USEPREFIX (otLogInfoMem, "MEM%!SPACE!"); +// otLogInfoMem{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_MEM}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogDebgMem, "[%p]MEM%!SPACE!", &CTX); -// otLogDebgMem{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_MEM}(CTX, MSG, ...); +// USEPREFIX (otLogDebgMem, "MEM%!SPACE!"); +// otLogDebgMem{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_MEM}(MSG, ...); // end_wpp // ==DUMP== @@ -550,94 +550,94 @@ // ==MEM== // begin_wpp config -// USEPREFIX (otLogCritNetDiag, "[%p]NETD%!SPACE!", &CTX); -// otLogCritNetDiag{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_NDIAG}(CTX, MSG, ...); +// USEPREFIX (otLogCritNetDiag, "NETD%!SPACE!"); +// otLogCritNetDiag{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_NDIAG}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogWarnNetDiag, "[%p]NETD%!SPACE!", &CTX); -// otLogWarnNetDiag{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_NDIAG}(CTX, MSG, ...); +// USEPREFIX (otLogWarnNetDiag, "NETD%!SPACE!"); +// otLogWarnNetDiag{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_NDIAG}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogNoteNetDiag, "[%p]NETD%!SPACE!", &CTX); -// otLogNoteNetDiag{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_NDIAG}(CTX, MSG, ...); +// USEPREFIX (otLogNoteNetDiag, "NETD%!SPACE!"); +// otLogNoteNetDiag{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_NDIAG}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogInfoNetDiag, "[%p]NETD%!SPACE!", &CTX); -// otLogInfoNetDiag{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_NDIAG}(CTX, MSG, ...); +// USEPREFIX (otLogInfoNetDiag, "NETD%!SPACE!"); +// otLogInfoNetDiag{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_NDIAG}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogDebgNetDiag, "[%p]NETD%!SPACE!", &CTX); -// otLogDebgNetDiag{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_NDIAG}(CTX, MSG, ...); +// USEPREFIX (otLogDebgNetDiag, "NETD%!SPACE!"); +// otLogDebgNetDiag{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_NDIAG}(MSG, ...); // end_wpp // ==COAP== // begin_wpp config -// USEPREFIX (otLogCritCoap, "[%p]COAP%!SPACE!", &CTX); -// otLogCritCoap{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_COAP}(CTX, MSG, ...); +// USEPREFIX (otLogCritCoap, "COAP%!SPACE!"); +// otLogCritCoap{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_COAP}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogWarnCoap, "[%p]COAP%!SPACE!", &CTX); -// otLogWarnCoap{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_COAP}(CTX, MSG, ...); +// USEPREFIX (otLogWarnCoap, "COAP%!SPACE!"); +// otLogWarnCoap{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_COAP}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogNoteCoap, "[%p]COAP%!SPACE!", &CTX); -// otLogNoteCoap{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_COAP}(CTX, MSG, ...); +// USEPREFIX (otLogNoteCoap, "COAP%!SPACE!"); +// otLogNoteCoap{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_COAP}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogInfoCoap, "[%p]COAP%!SPACE!", &CTX); -// otLogInfoCoap{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_COAP}(CTX, MSG, ...); +// USEPREFIX (otLogInfoCoap, "COAP%!SPACE!"); +// otLogInfoCoap{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_COAP}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogInfoCoapErr, "[%p]COAP%!SPACE!", &CTX); -// otLogInfoCoapErr{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_COAP}(CTX, EXP, MSG, ...); +// USEPREFIX (otLogInfoCoapErr, "COAP%!SPACE!"); +// otLogInfoCoapErr{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_COAP}(EXP, MSG, ...); // USESUFFIX(otLogInfoCoapErr, ", %!otError!", EXP); // end_wpp // begin_wpp config -// USEPREFIX (otLogDebgCoap, "[%p]COAP%!SPACE!", &CTX); -// otLogDebgCoap{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_COAP}(CTX, MSG, ...); +// USEPREFIX (otLogDebgCoap, "COAP%!SPACE!"); +// otLogDebgCoap{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_COAP}(MSG, ...); // end_wpp // ==CLI== // begin_wpp config -// USEPREFIX (otLogCritCli, "[%p]COAP%!SPACE!", &CTX); -// otLogCritCli{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_COAP}(CTX, MSG, ...); +// USEPREFIX (otLogCritCli, "COAP%!SPACE!"); +// otLogCritCli{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_COAP}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogWarnCli, "[%p]COAP%!SPACE!", &CTX); -// otLogWarnCli{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_COAP}(CTX, MSG, ...); +// USEPREFIX (otLogWarnCli, "COAP%!SPACE!"); +// otLogWarnCli{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_COAP}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogNoteCli, "[%p]COAP%!SPACE!", &CTX); -// otLogNoteCli{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_COAP}(CTX, MSG, ...); +// USEPREFIX (otLogNoteCli, "COAP%!SPACE!"); +// otLogNoteCli{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_COAP}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogInfoCli, "[%p]COAP%!SPACE!", &CTX); -// otLogInfoCli{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_COAP}(CTX, MSG, ...); +// USEPREFIX (otLogInfoCli, "COAP%!SPACE!"); +// otLogInfoCli{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_COAP}(MSG, ...); // end_wpp // begin_wpp config -// USEPREFIX (otLogInfoCliErr, "[%p]COAP%!SPACE!", &CTX); -// otLogInfoCliErr{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_COAP}(CTX, EXP, MSG, ...); +// USEPREFIX (otLogInfoCliErr, "COAP%!SPACE!"); +// otLogInfoCliErr{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_COAP}(EXP, MSG, ...); // USESUFFIX(otLogInfoCliErr, ", %!otError!", EXP); // end_wpp // begin_wpp config -// USEPREFIX (otLogDebgCli, "[%p]COAP%!SPACE!", &CTX); -// otLogDebgCli{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_COAP}(CTX, MSG, ...); +// USEPREFIX (otLogDebgCli, "COAP%!SPACE!"); +// otLogDebgCli{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_COAP}(MSG, ...); // end_wpp // ==FUNC== diff --git a/src/cli/cli_uart.cpp b/src/cli/cli_uart.cpp index de5286adf..5c704061e 100644 --- a/src/cli/cli_uart.cpp +++ b/src/cli/cli_uart.cpp @@ -200,7 +200,7 @@ otError Uart::ProcessCommand(void) #if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES /* TODO: how exactly do we get the instance here? */ #else - otLogInfoCli(Instance::Get(), "execute command: %s", mRxBuffer); + otLogInfoCli("execute command: %s", mRxBuffer); #endif #endif mInterpreter.ProcessLine(mRxBuffer, mRxLength, *this); diff --git a/src/core/Makefile.am b/src/core/Makefile.am index 55e9a5d36..3e487ea7a 100644 --- a/src/core/Makefile.am +++ b/src/core/Makefile.am @@ -121,6 +121,7 @@ SOURCES_COMMON = \ api/joiner_api.cpp \ api/link_api.cpp \ api/link_raw_api.cpp \ + api/logging_api.cpp \ api/message_api.cpp \ api/netdata_api.cpp \ api/network_time_api.cpp \ @@ -226,6 +227,7 @@ EXTRA_DIST = \ libopenthread_radio_a_SOURCES = \ api/instance_api.cpp \ api/link_raw_api.cpp \ + api/logging_api.cpp \ api/message_api.cpp \ api/tasklet_api.cpp \ common/instance.cpp \ diff --git a/src/core/api/instance_api.cpp b/src/core/api/instance_api.cpp index 7604371b2..95ccd0190 100644 --- a/src/core/api/instance_api.cpp +++ b/src/core/api/instance_api.cpp @@ -51,7 +51,7 @@ otInstance *otInstanceInit(void *aInstanceBuffer, size_t *aInstanceBufferSize) Instance *instance; instance = Instance::Init(aInstanceBuffer, aInstanceBufferSize); - otLogInfoApi(*instance, "otInstance Initialized"); + otLogInfoApi("otInstance Initialized"); return instance; } @@ -117,39 +117,6 @@ otError otInstanceErasePersistentInfo(otInstance *aInstance) } #endif // OPENTHREAD_MTD || OPENTHREAD_FTD -otLogLevel otGetDynamicLogLevel(otInstance *aInstance) -{ - otLogLevel logLevel; - -#if OPENTHREAD_CONFIG_ENABLE_DYNAMIC_LOG_LEVEL - Instance &instance = *static_cast(aInstance); - - logLevel = instance.GetDynamicLogLevel(); -#else - logLevel = static_cast(OPENTHREAD_CONFIG_LOG_LEVEL); - OT_UNUSED_VARIABLE(aInstance); -#endif - - return logLevel; -} - -otError otSetDynamicLogLevel(otInstance *aInstance, otLogLevel aLogLevel) -{ - otError error = OT_ERROR_NONE; - -#if OPENTHREAD_CONFIG_ENABLE_DYNAMIC_LOG_LEVEL - Instance &instance = *static_cast(aInstance); - - instance.SetDynamicLogLevel(aLogLevel); -#else - error = OT_ERROR_DISABLED_FEATURE; - OT_UNUSED_VARIABLE(aInstance); - OT_UNUSED_VARIABLE(aLogLevel); -#endif - - return error; -} - const char *otGetVersionString(void) { /** diff --git a/src/core/api/link_raw_api.cpp b/src/core/api/link_raw_api.cpp index 190aa9f29..bf4225f37 100644 --- a/src/core/api/link_raw_api.cpp +++ b/src/core/api/link_raw_api.cpp @@ -75,7 +75,7 @@ otError otLinkRawSetPromiscuous(otInstance *aInstance, bool aEnable) VerifyOrExit(static_cast(aInstance)->GetLinkRaw().IsEnabled(), error = OT_ERROR_INVALID_STATE); - otLogInfoPlat(aInstance, "LinkRaw Promiscuous=%d", aEnable ? 1 : 0); + otLogInfoPlat("LinkRaw Promiscuous=%d", aEnable ? 1 : 0); otPlatRadioSetPromiscuous(aInstance, aEnable); @@ -89,7 +89,7 @@ otError otLinkRawSleep(otInstance *aInstance) VerifyOrExit(static_cast(aInstance)->GetLinkRaw().IsEnabled(), error = OT_ERROR_INVALID_STATE); - otLogInfoPlat(aInstance, "LinkRaw Sleep"); + otLogInfoPlat("LinkRaw Sleep"); error = otPlatRadioSleep(aInstance); @@ -99,7 +99,7 @@ exit: otError otLinkRawReceive(otInstance *aInstance, otLinkRawReceiveDone aCallback) { - otLogInfoPlat(aInstance, "LinkRaw Recv"); + otLogInfoPlat("LinkRaw Recv"); return static_cast(aInstance)->GetLinkRaw().Receive(aCallback); } @@ -117,7 +117,7 @@ exit: otError otLinkRawTransmit(otInstance *aInstance, otRadioFrame *aFrame, otLinkRawTransmitDone aCallback) { - otLogInfoPlat(aInstance, "LinkRaw Transmit (%d bytes on channel %d)", aFrame->mLength, aFrame->mChannel); + otLogInfoPlat("LinkRaw Transmit (%d bytes on channel %d)", aFrame->mLength, aFrame->mChannel); return static_cast(aInstance)->GetLinkRaw().Transmit(aFrame, aCallback); } diff --git a/src/core/api/logging_api.cpp b/src/core/api/logging_api.cpp new file mode 100644 index 000000000..17481c4a2 --- /dev/null +++ b/src/core/api/logging_api.cpp @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2018, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * This file implements the OpenThread logging related APIs. + */ + +#define WPP_NAME "logging_api.tmh" + +#include "openthread-core-config.h" + +#include +#include "common/instance.hpp" + +using namespace ot; + +otLogLevel otLoggingGetLevel(void) +#if OPENTHREAD_CONFIG_ENABLE_DYNAMIC_LOG_LEVEL && !OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +{ + return Instance::Get().GetLogLevel(); +} +#else +{ + return static_cast(OPENTHREAD_CONFIG_LOG_LEVEL); +} +#endif + +otError otLoggingSetLevel(otLogLevel aLogLevel) +{ + otError error = OT_ERROR_DISABLED_FEATURE; + +#if OPENTHREAD_CONFIG_ENABLE_DYNAMIC_LOG_LEVEL +#if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES +#warning "Dynamic log level is not supported along with multiple OT instance feature (`ENABLE_MULTIPLE_INSTANCES`)" +#else + Instance::Get().SetLogLevel(aLogLevel); + error = OT_ERROR_NONE; +#endif +#endif + + OT_UNUSED_VARIABLE(aLogLevel); + return error; +} diff --git a/src/core/coap/coap.cpp b/src/core/coap/coap.cpp index d597a5410..080584428 100644 --- a/src/core/coap/coap.cpp +++ b/src/core/coap/coap.cpp @@ -550,7 +550,7 @@ exit: if (error) { - otLogInfoCoapErr(GetNetif().GetInstance(), error, "Receive failed"); + otLogInfoCoapErr(error, "Receive failed"); } } @@ -709,7 +709,7 @@ exit: if (error != OT_ERROR_NONE) { - otLogInfoCoapErr(GetNetif().GetInstance(), error, "Failed to process request"); + otLogInfoCoapErr(error, "Failed to process request"); if (error == OT_ERROR_NOT_FOUND) { diff --git a/src/core/common/instance.hpp b/src/core/common/instance.hpp index 568eafb6d..57f4499c8 100644 --- a/src/core/common/instance.hpp +++ b/src/core/common/instance.hpp @@ -180,24 +180,6 @@ public: */ TaskletScheduler &GetTaskletScheduler(void) { return mTaskletScheduler; } -#if OPENTHREAD_CONFIG_ENABLE_DYNAMIC_LOG_LEVEL - /** - * This method returns the current dynamic log level. - * - * @returns the currently set dynamic log level. - * - */ - otLogLevel GetDynamicLogLevel(void) const { return mLogLevel; } - - /** - * This method sets the dynamic log level. - * - * @param[in] aLogLevel The dynamic log level. - * - */ - void SetDynamicLogLevel(otLogLevel aLogLevel) { mLogLevel = aLogLevel; } -#endif - /** * This method returns the active log level. * @@ -207,7 +189,7 @@ public: otLogLevel GetLogLevel(void) const #if OPENTHREAD_CONFIG_ENABLE_DYNAMIC_LOG_LEVEL { - return GetDynamicLogLevel(); + return mLogLevel; } #else { @@ -215,6 +197,16 @@ public: } #endif +#if OPENTHREAD_CONFIG_ENABLE_DYNAMIC_LOG_LEVEL + /** + * This method sets the log level. + * + * @param[in] aLogLevel A log level. + * + */ + void SetLogLevel(otLogLevel aLogLevel) { mLogLevel = aLogLevel; } +#endif + /** * This method finalizes the OpenThread instance. * @@ -470,6 +462,7 @@ private: #if OPENTHREAD_RADIO || OPENTHREAD_ENABLE_RAW_LINK_API LinkRaw mLinkRaw; #endif // OPENTHREAD_RADIO || OPENTHREAD_ENABLE_RAW_LINK_API + #if OPENTHREAD_CONFIG_ENABLE_DYNAMIC_LOG_LEVEL otLogLevel mLogLevel; #endif diff --git a/src/core/common/logging.cpp b/src/core/common/logging.cpp index c30bc44c7..49d07af0a 100644 --- a/src/core/common/logging.cpp +++ b/src/core/common/logging.cpp @@ -48,7 +48,7 @@ #ifndef WINDOWS_LOGGING #define otLogDump(aFormat, ...) \ - _otDynamicLog(aInstance, aLogLevel, aLogRegion, aFormat OPENTHREAD_CONFIG_LOG_SUFFIX, ##__VA_ARGS__) + _otDynamicLog(aLogLevel, aLogRegion, aFormat OPENTHREAD_CONFIG_LOG_SUFFIX, ##__VA_ARGS__) #endif #ifdef __cplusplus @@ -65,11 +65,7 @@ extern "C" { * @param[in] aLength Number of bytes in the buffer. * */ -static void DumpLine(otInstance * aInstance, - otLogLevel aLogLevel, - otLogRegion aLogRegion, - const void * aBuf, - const size_t aLength) +static void DumpLine(otLogLevel aLogLevel, otLogRegion aLogRegion, const void *aBuf, const size_t aLength) { char buf[80]; char *cur = buf; @@ -117,16 +113,9 @@ static void DumpLine(otInstance * aInstance, } otLogDump("%s", buf); - - OT_UNUSED_VARIABLE(aInstance); } -void otDump(otInstance * aInstance, - otLogLevel aLogLevel, - otLogRegion aLogRegion, - const char * aId, - const void * aBuf, - const size_t aLength) +void otDump(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aId, const void *aBuf, const size_t aLength) { size_t idlen = strlen(aId); const size_t width = 72; @@ -152,7 +141,7 @@ void otDump(otInstance * aInstance, for (size_t i = 0; i < aLength; i += 16) { - DumpLine(aInstance, aLogLevel, aLogRegion, (uint8_t *)(aBuf) + i, (aLength - i) < 16 ? (aLength - i) : 16); + DumpLine(aLogLevel, aLogRegion, (uint8_t *)(aBuf) + i, (aLength - i) < 16 ? (aLength - i) : 16); } cur = buf; @@ -166,7 +155,7 @@ void otDump(otInstance * aInstance, otLogDump("%s", buf); } #else // OPENTHREAD_CONFIG_LOG_PKT_DUMP -void otDump(otInstance *, otLogLevel, otLogRegion, const char *, const void *, const size_t) +void otDump(otLogLevel, otLogRegion, const char *, const void *, const size_t) { } #endif // OPENTHREAD_CONFIG_LOG_PKT_DUMP diff --git a/src/core/common/logging.hpp b/src/core/common/logging.hpp index ab0ee5263..9e09fc287 100644 --- a/src/core/common/logging.hpp +++ b/src/core/common/logging.hpp @@ -28,7 +28,7 @@ /** * @file - * This file includes functions for debugging. + * This file includes logging related macro/function definitions. */ #ifndef LOGGING_HPP_ @@ -40,7 +40,7 @@ #include #include "utils/wrap_string.h" -#include +#include #include #ifdef WINDOWS_LOGGING @@ -124,17 +124,16 @@ extern "C" { * * Logging at log level critical. * - * @param[in] aInstance A pointer to the OpenThread instance. * @param[in] aRegion The log region. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * */ #if OPENTHREAD_CONFIG_LOG_LEVEL >= OT_LOG_LEVEL_CRIT -#define otLogCrit(aInstance, aRegion, aFormat, ...) \ - _otLogFormatter(aInstance, OT_LOG_LEVEL_CRIT, aRegion, _OT_LEVEL_CRIT_PREFIX aFormat, ##__VA_ARGS__) +#define otLogCrit(aRegion, aFormat, ...) \ + _otLogFormatter(OT_LOG_LEVEL_CRIT, aRegion, _OT_LEVEL_CRIT_PREFIX aFormat, ##__VA_ARGS__) #else -#define otLogCrit(aInstance, aRegion, aFormat, ...) +#define otLogCrit(aRegion, aFormat, ...) #endif /** @@ -142,17 +141,16 @@ extern "C" { * * Logging at log level warning. * - * @param[in] aInstance A pointer to the OpenThread instance. * @param[in] aRegion The log region. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * */ #if OPENTHREAD_CONFIG_LOG_LEVEL >= OT_LOG_LEVEL_WARN -#define otLogWarn(aInstance, aRegion, aFormat, ...) \ - _otLogFormatter(aInstance, OT_LOG_LEVEL_WARN, aRegion, _OT_LEVEL_WARN_PREFIX aFormat, ##__VA_ARGS__) +#define otLogWarn(aRegion, aFormat, ...) \ + _otLogFormatter(OT_LOG_LEVEL_WARN, aRegion, _OT_LEVEL_WARN_PREFIX aFormat, ##__VA_ARGS__) #else -#define otLogWarn(aInstance, aRegion, aFormat, ...) +#define otLogWarn(aRegion, aFormat, ...) #endif /** @@ -160,17 +158,16 @@ extern "C" { * * Logging at log level note * - * @param[in] aInstance A pointer to the OpenThread instance. * @param[in] aRegion The log region. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * */ #if OPENTHREAD_CONFIG_LOG_LEVEL >= OT_LOG_LEVEL_NOTE -#define otLogNote(aInstance, aRegion, aFormat, ...) \ - _otLogFormatter(aInstance, OT_LOG_LEVEL_NOTE, aRegion, _OT_LEVEL_NOTE_PREFIX aFormat, ##__VA_ARGS__) +#define otLogNote(aRegion, aFormat, ...) \ + _otLogFormatter(OT_LOG_LEVEL_NOTE, aRegion, _OT_LEVEL_NOTE_PREFIX aFormat, ##__VA_ARGS__) #else -#define otLogNote(aInstance, aRegion, aFormat, ...) +#define otLogNote(aRegion, aFormat, ...) #endif /** @@ -178,17 +175,16 @@ extern "C" { * * Logging at log level info. * - * @param[in] aInstance A pointer to the OpenThread instance. * @param[in] aRegion The log region. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * */ #if OPENTHREAD_CONFIG_LOG_LEVEL >= OT_LOG_LEVEL_INFO -#define otLogInfo(aInstance, aRegion, aFormat, ...) \ - _otLogFormatter(aInstance, OT_LOG_LEVEL_INFO, aRegion, _OT_LEVEL_INFO_PREFIX aFormat, ##__VA_ARGS__) +#define otLogInfo(aRegion, aFormat, ...) \ + _otLogFormatter(OT_LOG_LEVEL_INFO, aRegion, _OT_LEVEL_INFO_PREFIX aFormat, ##__VA_ARGS__) #else -#define otLogInfo(aInstance, aRegion, aFormat, ...) +#define otLogInfo(aRegion, aFormat, ...) #endif /** @@ -196,17 +192,16 @@ extern "C" { * * Logging at log level debug. * - * @param[in] aInstance A pointer to the OpenThread instance. * @param[in] aRegion The log region. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * */ #if OPENTHREAD_CONFIG_LOG_LEVEL >= OT_LOG_LEVEL_DEBG -#define otLogDebg(aInstance, aRegion, aFormat, ...) \ - _otLogFormatter(aInstance, OT_LOG_LEVEL_DEBG, aRegion, _OT_LEVEL_DEBG_PREFIX aFormat, ##__VA_ARGS__) +#define otLogDebg(aRegion, aFormat, ...) \ + _otLogFormatter(OT_LOG_LEVEL_DEBG, aRegion, _OT_LEVEL_DEBG_PREFIX aFormat, ##__VA_ARGS__) #else -#define otLogDebg(aInstance, aRegion, aFormat, ...) +#define otLogDebg(aRegion, aFormat, ...) #endif #ifndef WINDOWS_LOGGING @@ -216,7 +211,6 @@ extern "C" { * * This method generates a log with level critical for the API region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -227,7 +221,6 @@ extern "C" { * * This method generates a log with level warning for the API region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -238,7 +231,6 @@ extern "C" { * * This method generates a log with level note for the API region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -249,7 +241,6 @@ extern "C" { * * This method generates a log with level info for the API region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -260,28 +251,22 @@ extern "C" { * * This method generates a log with level debug for the API region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * */ #if OPENTHREAD_CONFIG_LOG_API == 1 -#define otLogCritApi(aInstance, aFormat, ...) \ - otLogCrit(&aInstance, OT_LOG_REGION_API, _OT_REGION_API_PREFIX aFormat, ##__VA_ARGS__) -#define otLogWarnApi(aInstance, aFormat, ...) \ - otLogWarn(&aInstance, OT_LOG_REGION_API, _OT_REGION_API_PREFIX aFormat, ##__VA_ARGS__) -#define otLogNoteApi(aInstance, aFormat, ...) \ - otLogNote(&aInstance, OT_LOG_REGION_API, _OT_REGION_API_PREFIX aFormat, ##__VA_ARGS__) -#define otLogInfoApi(aInstance, aFormat, ...) \ - otLogInfo(&aInstance, OT_LOG_REGION_API, _OT_REGION_API_PREFIX aFormat, ##__VA_ARGS__) -#define otLogDebgApi(aInstance, aFormat, ...) \ - otLogDebg(&aInstance, OT_LOG_REGION_API, _OT_REGION_API_PREFIX aFormat, ##__VA_ARGS__) +#define otLogCritApi(aFormat, ...) otLogCrit(OT_LOG_REGION_API, _OT_REGION_API_PREFIX aFormat, ##__VA_ARGS__) +#define otLogWarnApi(aFormat, ...) otLogWarn(OT_LOG_REGION_API, _OT_REGION_API_PREFIX aFormat, ##__VA_ARGS__) +#define otLogNoteApi(aFormat, ...) otLogNote(OT_LOG_REGION_API, _OT_REGION_API_PREFIX aFormat, ##__VA_ARGS__) +#define otLogInfoApi(aFormat, ...) otLogInfo(OT_LOG_REGION_API, _OT_REGION_API_PREFIX aFormat, ##__VA_ARGS__) +#define otLogDebgApi(aFormat, ...) otLogDebg(OT_LOG_REGION_API, _OT_REGION_API_PREFIX aFormat, ##__VA_ARGS__) #else -#define otLogCritApi(aInstance, aFormat, ...) -#define otLogWarnApi(aInstance, aFormat, ...) -#define otLogNoteApi(aInstance, aFormat, ...) -#define otLogInfoApi(aInstance, aFormat, ...) -#define otLogDebgApi(aInstance, aFormat, ...) +#define otLogCritApi(aFormat, ...) +#define otLogWarnApi(aFormat, ...) +#define otLogNoteApi(aFormat, ...) +#define otLogInfoApi(aFormat, ...) +#define otLogDebgApi(aFormat, ...) #endif /** @@ -289,7 +274,6 @@ extern "C" { * * This method generates a log with level critical for the MLE region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -301,7 +285,6 @@ extern "C" { * * This method generates a log with level warning for the MLE region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -312,7 +295,6 @@ extern "C" { * * This method generates a log with level note for the MLE region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -323,7 +305,6 @@ extern "C" { * * This method generates a log with level info for the MLE region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -334,42 +315,40 @@ extern "C" { * * This method generates a log with level debug for the MLE region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * */ #if OPENTHREAD_CONFIG_LOG_MLE == 1 -#define otLogCritMeshCoP(aInstance, aFormat, ...) \ - otLogCrit(&aInstance, OT_LOG_REGION_MESH_COP, _OT_REGION_MESH_COP_PREFIX aFormat, ##__VA_ARGS__) -#define otLogWarnMeshCoP(aInstance, aFormat, ...) \ - otLogWarn(&aInstance, OT_LOG_REGION_MESH_COP, _OT_REGION_MESH_COP_PREFIX aFormat, ##__VA_ARGS__) -#define otLogNoteMeshCoP(aInstance, aFormat, ...) \ - otLogNote(&aInstance, OT_LOG_REGION_MESH_COP, _OT_REGION_MESH_COP_PREFIX aFormat, ##__VA_ARGS__) -#define otLogInfoMeshCoP(aInstance, aFormat, ...) \ - otLogInfo(&aInstance, OT_LOG_REGION_MESH_COP, _OT_REGION_MESH_COP_PREFIX aFormat, ##__VA_ARGS__) -#define otLogDebgMeshCoP(aInstance, aFormat, ...) \ - otLogDebg(&aInstance, OT_LOG_REGION_MESH_COP, _OT_REGION_MESH_COP_PREFIX aFormat, ##__VA_ARGS__) +#define otLogCritMeshCoP(aFormat, ...) \ + otLogCrit(OT_LOG_REGION_MESH_COP, _OT_REGION_MESH_COP_PREFIX aFormat, ##__VA_ARGS__) +#define otLogWarnMeshCoP(aFormat, ...) \ + otLogWarn(OT_LOG_REGION_MESH_COP, _OT_REGION_MESH_COP_PREFIX aFormat, ##__VA_ARGS__) +#define otLogNoteMeshCoP(aFormat, ...) \ + otLogNote(OT_LOG_REGION_MESH_COP, _OT_REGION_MESH_COP_PREFIX aFormat, ##__VA_ARGS__) +#define otLogInfoMeshCoP(aFormat, ...) \ + otLogInfo(OT_LOG_REGION_MESH_COP, _OT_REGION_MESH_COP_PREFIX aFormat, ##__VA_ARGS__) +#define otLogDebgMeshCoP(aFormat, ...) \ + otLogDebg(OT_LOG_REGION_MESH_COP, _OT_REGION_MESH_COP_PREFIX aFormat, ##__VA_ARGS__) #else -#define otLogCritMeshCoP(aInstance, aFormat, ...) -#define otLogWarnMeshCoP(aInstance, aFormat, ...) -#define otLogNoteMeshCoP(aInstance, aFormat, ...) -#define otLogInfoMeshCoP(aInstance, aFormat, ...) -#define otLogDebgMeshCoP(aInstance, aFormat, ...) +#define otLogCritMeshCoP(aFormat, ...) +#define otLogWarnMeshCoP(aFormat, ...) +#define otLogNoteMeshCoP(aFormat, ...) +#define otLogInfoMeshCoP(aFormat, ...) +#define otLogDebgMeshCoP(aFormat, ...) #endif -#define otLogCritMbedTls(aInstance, aFormat, ...) otLogCritMeshCoP(aInstance, aFormat, ##__VA_ARGS__) -#define otLogWarnMbedTls(aInstance, aFormat, ...) otLogWarnMeshCoP(aInstance, aFormat, ##__VA_ARGS__) -#define otLogNoteMbedTls(aInstance, aFormat, ...) otLogNoteMeshCoP(aInstance, aFormat, ##__VA_ARGS__) -#define otLogInfoMbedTls(aInstance, aFormat, ...) otLogInfoMeshCoP(aInstance, aFormat, ##__VA_ARGS__) -#define otLogDebgMbedTls(aInstance, aFormat, ...) otLogDebgMeshCoP(aInstance, aFormat, ##__VA_ARGS__) +#define otLogCritMbedTls(aFormat, ...) otLogCritMeshCoP(aFormat, ##__VA_ARGS__) +#define otLogWarnMbedTls(aFormat, ...) otLogWarnMeshCoP(aFormat, ##__VA_ARGS__) +#define otLogNoteMbedTls(aFormat, ...) otLogNoteMeshCoP(aFormat, ##__VA_ARGS__) +#define otLogInfoMbedTls(aFormat, ...) otLogInfoMeshCoP(aFormat, ##__VA_ARGS__) +#define otLogDebgMbedTls(aFormat, ...) otLogDebgMeshCoP(aFormat, ##__VA_ARGS__) /** * @def otLogCritMle * * This method generates a log with level critical for the MLE region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -380,7 +359,6 @@ extern "C" { * * This method generates a log with level warning for the MLE region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -391,7 +369,6 @@ extern "C" { * * This method generates a log with level note for the MLE region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -402,7 +379,6 @@ extern "C" { * * This method generates a log with level info for the MLE region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -413,33 +389,27 @@ extern "C" { * * This method generates a log with level debug for the MLE region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * * */ #if OPENTHREAD_CONFIG_LOG_MLE == 1 -#define otLogCritMle(aInstance, aFormat, ...) \ - otLogCrit(&aInstance, OT_LOG_REGION_MLE, _OT_REGION_MLE_PREFIX aFormat, ##__VA_ARGS__) -#define otLogWarnMle(aInstance, aFormat, ...) \ - otLogWarn(&aInstance, OT_LOG_REGION_MLE, _OT_REGION_MLE_PREFIX aFormat, ##__VA_ARGS__) -#define otLogWarnMleErr(aInstance, aError, aFormat, ...) \ - otLogWarn(&aInstance, OT_LOG_REGION_MLE, _OT_REGION_MLE_PREFIX "Error %s: " aFormat, \ - otThreadErrorToString(aError), ##__VA_ARGS__) -#define otLogNoteMle(aInstance, aFormat, ...) \ - otLogNote(&aInstance, OT_LOG_REGION_MLE, _OT_REGION_MLE_PREFIX aFormat, ##__VA_ARGS__) -#define otLogInfoMle(aInstance, aFormat, ...) \ - otLogInfo(&aInstance, OT_LOG_REGION_MLE, _OT_REGION_MLE_PREFIX aFormat, ##__VA_ARGS__) -#define otLogDebgMle(aInstance, aFormat, ...) \ - otLogDebg(&aInstance, OT_LOG_REGION_MLE, _OT_REGION_MLE_PREFIX aFormat, ##__VA_ARGS__) +#define otLogCritMle(aFormat, ...) otLogCrit(OT_LOG_REGION_MLE, _OT_REGION_MLE_PREFIX aFormat, ##__VA_ARGS__) +#define otLogWarnMle(aFormat, ...) otLogWarn(OT_LOG_REGION_MLE, _OT_REGION_MLE_PREFIX aFormat, ##__VA_ARGS__) +#define otLogWarnMleErr(aError, aFormat, ...) \ + otLogWarn(OT_LOG_REGION_MLE, _OT_REGION_MLE_PREFIX "Error %s: " aFormat, otThreadErrorToString(aError), \ + ##__VA_ARGS__) +#define otLogNoteMle(aFormat, ...) otLogNote(OT_LOG_REGION_MLE, _OT_REGION_MLE_PREFIX aFormat, ##__VA_ARGS__) +#define otLogInfoMle(aFormat, ...) otLogInfo(OT_LOG_REGION_MLE, _OT_REGION_MLE_PREFIX aFormat, ##__VA_ARGS__) +#define otLogDebgMle(aFormat, ...) otLogDebg(OT_LOG_REGION_MLE, _OT_REGION_MLE_PREFIX aFormat, ##__VA_ARGS__) #else -#define otLogCritMle(aInstance, aFormat, ...) -#define otLogWarnMle(aInstance, aFormat, ...) -#define otLogWarnMleErr(aInstance, aError, aFormat, ...) -#define otLogNoteMle(aInstance, aFormat, ...) -#define otLogInfoMle(aInstance, aFormat, ...) -#define otLogDebgMle(aInstance, aFormat, ...) +#define otLogCritMle(aFormat, ...) +#define otLogWarnMle(aFormat, ...) +#define otLogWarnMleErr(aError, aFormat, ...) +#define otLogNoteMle(aFormat, ...) +#define otLogInfoMle(aFormat, ...) +#define otLogDebgMle(aFormat, ...) #endif /** @@ -447,7 +417,6 @@ extern "C" { * * This method generates a log with level critical for the EID-to-RLOC mapping region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -458,7 +427,6 @@ extern "C" { * * This method generates a log with level warning for the EID-to-RLOC mapping region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -469,7 +437,6 @@ extern "C" { * * This method generates a log with level note for the EID-to-RLOC mapping region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -480,7 +447,6 @@ extern "C" { * * This method generates a log with level info for the EID-to-RLOC mapping region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -491,28 +457,22 @@ extern "C" { * * This method generates a log with level debug for the EID-to-RLOC mapping region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * */ #if OPENTHREAD_CONFIG_LOG_ARP == 1 -#define otLogCritArp(aInstance, aFormat, ...) \ - otLogCrit(&aInstance, OT_LOG_REGION_ARP, _OT_REGION_ARP_PREFIX aFormat, ##__VA_ARGS__) -#define otLogWarnArp(aInstance, aFormat, ...) \ - otLogWarn(&aInstance, OT_LOG_REGION_ARP, _OT_REGION_ARP_PREFIX aFormat, ##__VA_ARGS__) -#define otLogNoteArp(aInstance, aFormat, ...) \ - otLogNote(&aInstance, OT_LOG_REGION_ARP, _OT_REGION_ARP_PREFIX aFormat, ##__VA_ARGS__) -#define otLogInfoArp(aInstance, aFormat, ...) \ - otLogInfo(&aInstance, OT_LOG_REGION_ARP, _OT_REGION_ARP_PREFIX aFormat, ##__VA_ARGS__) -#define otLogDebgArp(aInstance, aFormat, ...) \ - otLogDebg(&aInstance, OT_LOG_REGION_ARP, _OT_REGION_ARP_PREFIX aFormat, ##__VA_ARGS__) +#define otLogCritArp(aFormat, ...) otLogCrit(OT_LOG_REGION_ARP, _OT_REGION_ARP_PREFIX aFormat, ##__VA_ARGS__) +#define otLogWarnArp(aFormat, ...) otLogWarn(OT_LOG_REGION_ARP, _OT_REGION_ARP_PREFIX aFormat, ##__VA_ARGS__) +#define otLogNoteArp(aFormat, ...) otLogNote(OT_LOG_REGION_ARP, _OT_REGION_ARP_PREFIX aFormat, ##__VA_ARGS__) +#define otLogInfoArp(aFormat, ...) otLogInfo(OT_LOG_REGION_ARP, _OT_REGION_ARP_PREFIX aFormat, ##__VA_ARGS__) +#define otLogDebgArp(aFormat, ...) otLogDebg(OT_LOG_REGION_ARP, _OT_REGION_ARP_PREFIX aFormat, ##__VA_ARGS__) #else -#define otLogCritArp(aInstance, aFormat, ...) -#define otLogWarnArp(aInstance, aFormat, ...) -#define otLogNoteArp(aInstance, aFormat, ...) -#define otLogInfoArp(aInstance, aFormat, ...) -#define otLogDebgArp(aInstance, aFormat, ...) +#define otLogCritArp(aFormat, ...) +#define otLogWarnArp(aFormat, ...) +#define otLogNoteArp(aFormat, ...) +#define otLogInfoArp(aFormat, ...) +#define otLogDebgArp(aFormat, ...) #endif /** @@ -520,7 +480,6 @@ extern "C" { * * This method generates a log with level critical for the Network Data region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -531,7 +490,6 @@ extern "C" { * * This method generates a log with level warning for the Network Data region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -542,7 +500,6 @@ extern "C" { * * This method generates a log with level note for the Network Data region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -553,7 +510,6 @@ extern "C" { * * This method generates a log with level info for the Network Data region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -564,28 +520,27 @@ extern "C" { * * This method generates a log with level debug for the Network Data region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * */ #if OPENTHREAD_CONFIG_LOG_NETDATA == 1 -#define otLogCritNetData(aInstance, aFormat, ...) \ - otLogCrit(&aInstance, OT_LOG_REGION_NET_DATA, _OT_REGION_NET_DATA_PREFIX aFormat, ##__VA_ARGS__) -#define otLogWarnNetData(aInstance, aFormat, ...) \ - otLogWarn(&aInstance, OT_LOG_REGION_NET_DATA, _OT_REGION_NET_DATA_PREFIX aFormat, ##__VA_ARGS__) -#define otLogNoteNetData(aInstance, aFormat, ...) \ - otLogNote(&aInstance, OT_LOG_REGION_NET_DATA, _OT_REGION_NET_DATA_PREFIX aFormat, ##__VA_ARGS__) -#define otLogInfoNetData(aInstance, aFormat, ...) \ - otLogInfo(&aInstance, OT_LOG_REGION_NET_DATA, _OT_REGION_NET_DATA_PREFIX aFormat, ##__VA_ARGS__) -#define otLogDebgNetData(aInstance, aFormat, ...) \ - otLogDebg(&aInstance, OT_LOG_REGION_NET_DATA, _OT_REGION_NET_DATA_PREFIX aFormat, ##__VA_ARGS__) +#define otLogCritNetData(aFormat, ...) \ + otLogCrit(OT_LOG_REGION_NET_DATA, _OT_REGION_NET_DATA_PREFIX aFormat, ##__VA_ARGS__) +#define otLogWarnNetData(aFormat, ...) \ + otLogWarn(OT_LOG_REGION_NET_DATA, _OT_REGION_NET_DATA_PREFIX aFormat, ##__VA_ARGS__) +#define otLogNoteNetData(aFormat, ...) \ + otLogNote(OT_LOG_REGION_NET_DATA, _OT_REGION_NET_DATA_PREFIX aFormat, ##__VA_ARGS__) +#define otLogInfoNetData(aFormat, ...) \ + otLogInfo(OT_LOG_REGION_NET_DATA, _OT_REGION_NET_DATA_PREFIX aFormat, ##__VA_ARGS__) +#define otLogDebgNetData(aFormat, ...) \ + otLogDebg(OT_LOG_REGION_NET_DATA, _OT_REGION_NET_DATA_PREFIX aFormat, ##__VA_ARGS__) #else -#define otLogCritNetData(aInstance, aFormat, ...) -#define otLogWarnNetData(aInstance, aFormat, ...) -#define otLogNoteNetData(aInstance, aFormat, ...) -#define otLogInfoNetData(aInstance, aFormat, ...) -#define otLogDebgNetData(aInstance, aFormat, ...) +#define otLogCritNetData(aFormat, ...) +#define otLogWarnNetData(aFormat, ...) +#define otLogNoteNetData(aFormat, ...) +#define otLogInfoNetData(aFormat, ...) +#define otLogDebgNetData(aFormat, ...) #endif /** @@ -593,7 +548,6 @@ extern "C" { * * This method generates a log with level critical for the ICMPv6 region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -604,7 +558,6 @@ extern "C" { * * This method generates a log with level warning for the ICMPv6 region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -615,7 +568,6 @@ extern "C" { * * This method generates a log with level note for the ICMPv6 region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -626,7 +578,6 @@ extern "C" { * * This method generates a log with level info for the ICMPv6 region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -637,28 +588,22 @@ extern "C" { * * This method generates a log with level debug for the ICMPv6 region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * */ #if OPENTHREAD_CONFIG_LOG_ICMP == 1 -#define otLogCritIcmp(aInstance, aFormat, ...) \ - otLogCrit(&aInstance, OT_LOG_REGION_ICMP, _OT_REGION_ICMP_PREFIX aFormat, ##__VA_ARGS__) -#define otLogWarnIcmp(aInstance, aFormat, ...) \ - otLogWarn(&aInstance, OT_LOG_REGION_ICMP, _OT_REGION_ICMP_PREFIX aFormat, ##__VA_ARGS__) -#define otLogNoteIcmp(aInstance, aFormat, ...) \ - otLogNote(&aInstance, OT_LOG_REGION_ICMP, _OT_REGION_ICMP_PREFIX aFormat, ##__VA_ARGS__) -#define otLogInfoIcmp(aInstance, aFormat, ...) \ - otLogInfo(&aInstance, OT_LOG_REGION_ICMP, _OT_REGION_ICMP_PREFIX aFormat, ##__VA_ARGS__) -#define otLogDebgIcmp(aInstance, aFormat, ...) \ - otLogDebg(&aInstance, OT_LOG_REGION_ICMP, _OT_REGION_ICMP_PREFIX aFormat, ##__VA_ARGS__) +#define otLogCritIcmp(aFormat, ...) otLogCrit(OT_LOG_REGION_ICMP, _OT_REGION_ICMP_PREFIX aFormat, ##__VA_ARGS__) +#define otLogWarnIcmp(aFormat, ...) otLogWarn(OT_LOG_REGION_ICMP, _OT_REGION_ICMP_PREFIX aFormat, ##__VA_ARGS__) +#define otLogNoteIcmp(aFormat, ...) otLogNote(OT_LOG_REGION_ICMP, _OT_REGION_ICMP_PREFIX aFormat, ##__VA_ARGS__) +#define otLogInfoIcmp(aFormat, ...) otLogInfo(OT_LOG_REGION_ICMP, _OT_REGION_ICMP_PREFIX aFormat, ##__VA_ARGS__) +#define otLogDebgIcmp(aFormat, ...) otLogDebg(OT_LOG_REGION_ICMP, _OT_REGION_ICMP_PREFIX aFormat, ##__VA_ARGS__) #else -#define otLogCritIcmp(aInstance, aFormat, ...) -#define otLogWarnIcmp(aInstance, aFormat, ...) -#define otLogNoteIcmp(aInstance, aFormat, ...) -#define otLogInfoIcmp(aInstance, aFormat, ...) -#define otLogDebgIcmp(aInstance, aFormat, ...) +#define otLogCritIcmp(aFormat, ...) +#define otLogWarnIcmp(aFormat, ...) +#define otLogNoteIcmp(aFormat, ...) +#define otLogInfoIcmp(aFormat, ...) +#define otLogDebgIcmp(aFormat, ...) #endif /** @@ -666,7 +611,6 @@ extern "C" { * * This method generates a log with level critical for the IPv6 region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -677,7 +621,6 @@ extern "C" { * * This method generates a log with level warning for the IPv6 region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -688,7 +631,6 @@ extern "C" { * * This method generates a log with level note for the IPv6 region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -699,7 +641,6 @@ extern "C" { * * This method generates a log with level info for the IPv6 region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -710,28 +651,22 @@ extern "C" { * * This method generates a log with level debug for the IPv6 region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * */ #if OPENTHREAD_CONFIG_LOG_IP6 == 1 -#define otLogCritIp6(aInstance, aFormat, ...) \ - otLogCrit(&aInstance, OT_LOG_REGION_IP6, _OT_REGION_IP6_PREFIX aFormat, ##__VA_ARGS__) -#define otLogWarnIp6(aInstance, aFormat, ...) \ - otLogWarn(&aInstance, OT_LOG_REGION_IP6, _OT_REGION_IP6_PREFIX aFormat, ##__VA_ARGS__) -#define otLogNoteIp6(aInstance, aFormat, ...) \ - otLogNote(&aInstance, OT_LOG_REGION_IP6, _OT_REGION_IP6_PREFIX aFormat, ##__VA_ARGS__) -#define otLogInfoIp6(aInstance, aFormat, ...) \ - otLogInfo(&aInstance, OT_LOG_REGION_IP6, _OT_REGION_IP6_PREFIX aFormat, ##__VA_ARGS__) -#define otLogDebgIp6(aInstance, aFormat, ...) \ - otLogDebg(&aInstance, OT_LOG_REGION_IP6, _OT_REGION_IP6_PREFIX aFormat, ##__VA_ARGS__) +#define otLogCritIp6(aFormat, ...) otLogCrit(OT_LOG_REGION_IP6, _OT_REGION_IP6_PREFIX aFormat, ##__VA_ARGS__) +#define otLogWarnIp6(aFormat, ...) otLogWarn(OT_LOG_REGION_IP6, _OT_REGION_IP6_PREFIX aFormat, ##__VA_ARGS__) +#define otLogNoteIp6(aFormat, ...) otLogNote(OT_LOG_REGION_IP6, _OT_REGION_IP6_PREFIX aFormat, ##__VA_ARGS__) +#define otLogInfoIp6(aFormat, ...) otLogInfo(OT_LOG_REGION_IP6, _OT_REGION_IP6_PREFIX aFormat, ##__VA_ARGS__) +#define otLogDebgIp6(aFormat, ...) otLogDebg(OT_LOG_REGION_IP6, _OT_REGION_IP6_PREFIX aFormat, ##__VA_ARGS__) #else -#define otLogCritIp6(aInstance, aFormat, ...) -#define otLogWarnIp6(aInstance, aFormat, ...) -#define otLogNoteIp6(aInstance, aFormat, ...) -#define otLogInfoIp6(aInstance, aFormat, ...) -#define otLogDebgIp6(aInstance, aFormat, ...) +#define otLogCritIp6(aFormat, ...) +#define otLogWarnIp6(aFormat, ...) +#define otLogNoteIp6(aFormat, ...) +#define otLogInfoIp6(aFormat, ...) +#define otLogDebgIp6(aFormat, ...) #endif /** @@ -739,7 +674,6 @@ extern "C" { * * This method generates a log with level critical for the MAC region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -750,7 +684,6 @@ extern "C" { * * This method generates a log with level warning for the MAC region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -761,7 +694,6 @@ extern "C" { * * This method generates a log with level note for the MAC region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -772,7 +704,6 @@ extern "C" { * * This method generates a log with level info for the MAC region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -783,7 +714,6 @@ extern "C" { * * This method generates a log with level debug for the MAC region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -794,44 +724,38 @@ extern "C" { * * This method generates a log with a given log level for the MAC region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aLogLevel A log level. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * */ #if OPENTHREAD_CONFIG_LOG_MAC == 1 -#define otLogCritMac(aInstance, aFormat, ...) \ - otLogCrit(&aInstance, OT_LOG_REGION_MAC, _OT_REGION_MAC_PREFIX aFormat, ##__VA_ARGS__) -#define otLogWarnMac(aInstance, aFormat, ...) \ - otLogWarn(&aInstance, OT_LOG_REGION_MAC, _OT_REGION_MAC_PREFIX aFormat, ##__VA_ARGS__) -#define otLogNoteMac(aInstance, aFormat, ...) \ - otLogNote(&aInstance, OT_LOG_REGION_MAC, _OT_REGION_MAC_PREFIX aFormat, ##__VA_ARGS__) -#define otLogInfoMac(aInstance, aFormat, ...) \ - otLogInfo(&aInstance, OT_LOG_REGION_MAC, _OT_REGION_MAC_PREFIX aFormat, ##__VA_ARGS__) -#define otLogDebgMac(aInstance, aFormat, ...) \ - otLogDebg(&aInstance, OT_LOG_REGION_MAC, _OT_REGION_MAC_PREFIX aFormat, ##__VA_ARGS__) -#define otLogDebgMacErr(aInstance, aError, aFormat, ...) \ - otLogWarn(aInstance, OT_LOG_REGION_MAC, _OT_REGION_MAC_PREFIX "Error %s: " aFormat, otThreadErrorToString(aError), \ +#define otLogCritMac(aFormat, ...) otLogCrit(OT_LOG_REGION_MAC, _OT_REGION_MAC_PREFIX aFormat, ##__VA_ARGS__) +#define otLogWarnMac(aFormat, ...) otLogWarn(OT_LOG_REGION_MAC, _OT_REGION_MAC_PREFIX aFormat, ##__VA_ARGS__) +#define otLogNoteMac(aFormat, ...) otLogNote(OT_LOG_REGION_MAC, _OT_REGION_MAC_PREFIX aFormat, ##__VA_ARGS__) +#define otLogInfoMac(aFormat, ...) otLogInfo(OT_LOG_REGION_MAC, _OT_REGION_MAC_PREFIX aFormat, ##__VA_ARGS__) +#define otLogDebgMac(aFormat, ...) otLogDebg(OT_LOG_REGION_MAC, _OT_REGION_MAC_PREFIX aFormat, ##__VA_ARGS__) +#define otLogDebgMacErr(aError, aFormat, ...) \ + otLogWarn(OT_LOG_REGION_MAC, _OT_REGION_MAC_PREFIX "Error %s: " aFormat, otThreadErrorToString(aError), \ ##__VA_ARGS__) -#define otLogMac(aInstance, aLogLevel, aFormat, ...) \ - do \ - { \ - if (aInstance.GetLogLevel() >= aLogLevel) \ - { \ - _otLogFormatter(&aInstance, aLogLevel, OT_LOG_REGION_MAC, "%s" _OT_REGION_MAC_PREFIX aFormat, \ - otLogLevelToPrefixString(aLogLevel), ##__VA_ARGS__); \ - } \ +#define otLogMac(aLogLevel, aFormat, ...) \ + do \ + { \ + if (otLoggingGetLevel() >= aLogLevel) \ + { \ + _otLogFormatter(aLogLevel, OT_LOG_REGION_MAC, "%s" _OT_REGION_MAC_PREFIX aFormat, \ + otLogLevelToPrefixString(aLogLevel), ##__VA_ARGS__); \ + } \ } while (false) #else -#define otLogCritMac(aInstance, aFormat, ...) -#define otLogWarnMac(aInstance, aFormat, ...) -#define otLogNoteMac(aInstance, aFormat, ...) -#define otLogInfoMac(aInstance, aFormat, ...) -#define otLogDebgMac(aInstance, aFormat, ...) -#define otLogDebgMacErr(aInstance, aError, aFormat, ...) -#define otLogMac(aInstance, aLogLevel, aFormat, ...) +#define otLogCritMac(aFormat, ...) +#define otLogWarnMac(aFormat, ...) +#define otLogNoteMac(aFormat, ...) +#define otLogInfoMac(aFormat, ...) +#define otLogDebgMac(aFormat, ...) +#define otLogDebgMacErr(aError, aFormat, ...) +#define otLogMac(aLogLevel, aFormat, ...) #endif /** @@ -839,7 +763,6 @@ extern "C" { * * This method generates a log with level critical for the Core region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -850,7 +773,6 @@ extern "C" { * * This method generates a log with level warning for the Core region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -861,7 +783,6 @@ extern "C" { * * This method generates a log with level note for the Core region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -872,7 +793,6 @@ extern "C" { * * This method generates a log with level info for the Core region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -883,31 +803,25 @@ extern "C" { * * This method generates a log with level debug for the Core region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * */ #if OPENTHREAD_CONFIG_LOG_CORE == 1 -#define otLogCritCore(aInstance, aFormat, ...) \ - otLogCrit(&aInstance, OT_LOG_REGION_CORE, _OT_REGION_CORE_PREFIX aFormat, ##__VA_ARGS__) -#define otLogWarnCore(aInstance, aFormat, ...) \ - otLogWarn(&aInstance, OT_LOG_REGION_CORE, _OT_REGION_CORE_PREFIX aFormat, ##__VA_ARGS__) -#define otLogNoteCore(aInstance, aFormat, ...) \ - otLogNote(&aInstance, OT_LOG_REGION_CORE, _OT_REGION_CORE_PREFIX aFormat, ##__VA_ARGS__) -#define otLogInfoCore(aInstance, aFormat, ...) \ - otLogInfo(&aInstance, OT_LOG_REGION_CORE, _OT_REGION_CORE_PREFIX aFormat, ##__VA_ARGS__) -#define otLogDebgCore(aInstance, aFormat, ...) \ - otLogDebg(&aInstance, OT_LOG_REGION_CORE, _OT_REGION_CORE_PREFIX aFormat, ##__VA_ARGS__) -#define otLogDebgCoreErr(aInstance, aError, aFormat, ...) \ - otLogWarn(aInstance, OT_LOG_REGION_CORE, _OT_REGION_CORE_PREFIX "Error %s: " aFormat, \ - otThreadErrorToString(aError), ##__VA_ARGS__) +#define otLogCritCore(aFormat, ...) otLogCrit(OT_LOG_REGION_CORE, _OT_REGION_CORE_PREFIX aFormat, ##__VA_ARGS__) +#define otLogWarnCore(aFormat, ...) otLogWarn(OT_LOG_REGION_CORE, _OT_REGION_CORE_PREFIX aFormat, ##__VA_ARGS__) +#define otLogNoteCore(aFormat, ...) otLogNote(OT_LOG_REGION_CORE, _OT_REGION_CORE_PREFIX aFormat, ##__VA_ARGS__) +#define otLogInfoCore(aFormat, ...) otLogInfo(OT_LOG_REGION_CORE, _OT_REGION_CORE_PREFIX aFormat, ##__VA_ARGS__) +#define otLogDebgCore(aFormat, ...) otLogDebg(OT_LOG_REGION_CORE, _OT_REGION_CORE_PREFIX aFormat, ##__VA_ARGS__) +#define otLogDebgCoreErr(aError, aFormat, ...) \ + otLogWarn(OT_LOG_REGION_CORE, _OT_REGION_CORE_PREFIX "Error %s: " aFormat, otThreadErrorToString(aError), \ + ##__VA_ARGS__) #else -#define otLogCritCore(aInstance, aFormat, ...) -#define otLogWarnCore(aInstance, aFormat, ...) -#define otLogInfoCore(aInstance, aFormat, ...) -#define otLogDebgCore(aInstance, aFormat, ...) -#define otLogDebgCoreErr(aInstance, aError, aFormat, ...) +#define otLogCritCore(aFormat, ...) +#define otLogWarnCore(aFormat, ...) +#define otLogInfoCore(aFormat, ...) +#define otLogDebgCore(aFormat, ...) +#define otLogDebgCoreErr(aError, aFormat, ...) #endif /** @@ -915,7 +829,6 @@ extern "C" { * * This method generates a log with level critical for the memory region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -926,7 +839,6 @@ extern "C" { * * This method generates a log with level warning for the memory region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -937,7 +849,6 @@ extern "C" { * * This method generates a log with level note for the memory region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -948,7 +859,6 @@ extern "C" { * * This method generates a log with level info for the memory region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -959,28 +869,22 @@ extern "C" { * * This method generates a log with level debug for the memory region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * */ #if OPENTHREAD_CONFIG_LOG_MEM == 1 -#define otLogCritMem(aInstance, aFormat, ...) \ - otLogCrit(&aInstance, OT_LOG_REGION_MEM, _OT_REGION_MEM_PREFIX aFormat, ##__VA_ARGS__) -#define otLogWarnMem(aInstance, aFormat, ...) \ - otLogWarn(&aInstance, OT_LOG_REGION_MEM, _OT_REGION_MEM_PREFIX aFormat, ##__VA_ARGS__) -#define otLogNoteMem(aInstance, aFormat, ...) \ - otLogNote(&aInstance, OT_LOG_REGION_MEM, _OT_REGION_MEM_PREFIX aFormat, ##__VA_ARGS__) -#define otLogInfoMem(aInstance, aFormat, ...) \ - otLogInfo(&aInstance, OT_LOG_REGION_MEM, _OT_REGION_MEM_PREFIX aFormat, ##__VA_ARGS__) -#define otLogDebgMem(aInstance, aFormat, ...) \ - otLogDebg(&aInstance, OT_LOG_REGION_MEM, _OT_REGION_MEM_PREFIX aFormat, ##__VA_ARGS__) +#define otLogCritMem(aFormat, ...) otLogCrit(OT_LOG_REGION_MEM, _OT_REGION_MEM_PREFIX aFormat, ##__VA_ARGS__) +#define otLogWarnMem(aFormat, ...) otLogWarn(OT_LOG_REGION_MEM, _OT_REGION_MEM_PREFIX aFormat, ##__VA_ARGS__) +#define otLogNoteMem(aFormat, ...) otLogNote(OT_LOG_REGION_MEM, _OT_REGION_MEM_PREFIX aFormat, ##__VA_ARGS__) +#define otLogInfoMem(aFormat, ...) otLogInfo(OT_LOG_REGION_MEM, _OT_REGION_MEM_PREFIX aFormat, ##__VA_ARGS__) +#define otLogDebgMem(aFormat, ...) otLogDebg(OT_LOG_REGION_MEM, _OT_REGION_MEM_PREFIX aFormat, ##__VA_ARGS__) #else -#define otLogCritMem(aInstance, aFormat, ...) -#define otLogWarnMem(aInstance, aFormat, ...) -#define otLogNoteMem(aInstance, aFormat, ...) -#define otLogInfoMem(aInstance, aFormat, ...) -#define otLogDebgMem(aInstance, aFormat, ...) +#define otLogCritMem(aFormat, ...) +#define otLogWarnMem(aFormat, ...) +#define otLogNoteMem(aFormat, ...) +#define otLogInfoMem(aFormat, ...) +#define otLogDebgMem(aFormat, ...) #endif /** @@ -988,7 +892,6 @@ extern "C" { * * This method generates a log with level critical for the Util region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -999,7 +902,6 @@ extern "C" { * * This method generates a log with level warning for the Util region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -1010,7 +912,6 @@ extern "C" { * * This method generates a log with level note for the Util region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -1021,7 +922,6 @@ extern "C" { * * This method generates a log with level info for the Util region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -1032,32 +932,26 @@ extern "C" { * * This method generates a log with level debug for the Util region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * */ #if OPENTHREAD_CONFIG_LOG_UTIL == 1 -#define otLogCritUtil(aInstance, aFormat, ...) \ - otLogCrit(&aInstance, OT_LOG_REGION_UTIL, _OT_REGION_UTIL_PREFIX aFormat, ##__VA_ARGS__) -#define otLogWarnUtil(aInstance, aFormat, ...) \ - otLogWarn(&aInstance, OT_LOG_REGION_UTIL, _OT_REGION_UTIL_PREFIX aFormat, ##__VA_ARGS__) -#define otLogNoteUtil(aInstance, aFormat, ...) \ - otLogNote(&aInstance, OT_LOG_REGION_UTIL, _OT_REGION_UTIL_PREFIX aFormat, ##__VA_ARGS__) -#define otLogInfoUtil(aInstance, aFormat, ...) \ - otLogInfo(&aInstance, OT_LOG_REGION_UTIL, _OT_REGION_UTIL_PREFIX aFormat, ##__VA_ARGS__) -#define otLogInfoUtilErr(aInstance, aError, aFormat, ...) \ - otLogInfo(&aInstance, OT_LOG_REGION_UTIL, _OT_REGION_CORE_PREFIX "Error %s: " aFormat, \ - otThreadErrorToString(aError), ##__VA_ARGS__) -#define otLogDebgUtil(aInstance, aFormat, ...) \ - otLogDebg(&aInstance, OT_LOG_REGION_UTIL, _OT_REGION_UTIL_PREFIX aFormat, ##__VA_ARGS__) +#define otLogCritUtil(aFormat, ...) otLogCrit(OT_LOG_REGION_UTIL, _OT_REGION_UTIL_PREFIX aFormat, ##__VA_ARGS__) +#define otLogWarnUtil(aFormat, ...) otLogWarn(OT_LOG_REGION_UTIL, _OT_REGION_UTIL_PREFIX aFormat, ##__VA_ARGS__) +#define otLogNoteUtil(aFormat, ...) otLogNote(OT_LOG_REGION_UTIL, _OT_REGION_UTIL_PREFIX aFormat, ##__VA_ARGS__) +#define otLogInfoUtil(aFormat, ...) otLogInfo(OT_LOG_REGION_UTIL, _OT_REGION_UTIL_PREFIX aFormat, ##__VA_ARGS__) +#define otLogInfoUtilErr(aError, aFormat, ...) \ + otLogInfo(OT_LOG_REGION_UTIL, _OT_REGION_CORE_PREFIX "Error %s: " aFormat, otThreadErrorToString(aError), \ + ##__VA_ARGS__) +#define otLogDebgUtil(aFormat, ...) otLogDebg(OT_LOG_REGION_UTIL, _OT_REGION_UTIL_PREFIX aFormat, ##__VA_ARGS__) #else -#define otLogCritUtil(aInstance, aFormat, ...) -#define otLogWarnUtil(aInstance, aFormat, ...) -#define otLogNoteUtil(aInstance, aFormat, ...) -#define otLogInfoUtil(aInstance, aFormat, ...) -#define otLogInfoUtilErr(aInstance, aError, aFormat, ...) -#define otLogDebgUtil(aInstance, aFormat, ...) +#define otLogCritUtil(aFormat, ...) +#define otLogWarnUtil(aFormat, ...) +#define otLogNoteUtil(aFormat, ...) +#define otLogInfoUtil(aFormat, ...) +#define otLogInfoUtilErr(aError, aFormat, ...) +#define otLogDebgUtil(aFormat, ...) #endif /** @@ -1065,7 +959,6 @@ extern "C" { * * This method generates a log with level critical for the NETDIAG region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -1076,7 +969,6 @@ extern "C" { * * This method generates a log with level warning for the NETDIAG region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -1087,7 +979,6 @@ extern "C" { * * This method generates a log with level note for the NETDIAG region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -1098,7 +989,6 @@ extern "C" { * * This method generates a log with level info for the NETDIAG region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -1109,28 +999,27 @@ extern "C" { * * This method generates a log with level debug for the NETDIAG region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * */ #if OPENTHREAD_CONFIG_LOG_NETDIAG == 1 -#define otLogCritNetDiag(aInstance, aFormat, ...) \ - otLogCrit(&aInstance, OT_LOG_REGION_NET_DIAG, _OT_REGION_NET_DIAG_PREFIX aFormat, ##__VA_ARGS__) -#define otLogWarnNetDiag(aInstance, aFormat, ...) \ - otLogWarn(&aInstance, OT_LOG_REGION_NET_DIAG, _OT_REGION_NET_DIAG_PREFIX aFormat, ##__VA_ARGS__) -#define otLogNoteNetDiag(aInstance, aFormat, ...) \ - otLogNote(&aInstance, OT_LOG_REGION_NET_DIAG, _OT_REGION_NET_DIAG_PREFIX aFormat, ##__VA_ARGS__) -#define otLogInfoNetDiag(aInstance, aFormat, ...) \ - otLogInfo(&aInstance, OT_LOG_REGION_NET_DIAG, _OT_REGION_NET_DIAG_PREFIX aFormat, ##__VA_ARGS__) -#define otLogDebgNetDiag(aInstance, aFormat, ...) \ - otLogDebg(&aInstance, OT_LOG_REGION_NET_DIAG, _OT_REGION_NET_DIAG_PREFIX aFormat, ##__VA_ARGS__) +#define otLogCritNetDiag(aFormat, ...) \ + otLogCrit(OT_LOG_REGION_NET_DIAG, _OT_REGION_NET_DIAG_PREFIX aFormat, ##__VA_ARGS__) +#define otLogWarnNetDiag(aFormat, ...) \ + otLogWarn(OT_LOG_REGION_NET_DIAG, _OT_REGION_NET_DIAG_PREFIX aFormat, ##__VA_ARGS__) +#define otLogNoteNetDiag(aFormat, ...) \ + otLogNote(OT_LOG_REGION_NET_DIAG, _OT_REGION_NET_DIAG_PREFIX aFormat, ##__VA_ARGS__) +#define otLogInfoNetDiag(aFormat, ...) \ + otLogInfo(OT_LOG_REGION_NET_DIAG, _OT_REGION_NET_DIAG_PREFIX aFormat, ##__VA_ARGS__) +#define otLogDebgNetDiag(aFormat, ...) \ + otLogDebg(OT_LOG_REGION_NET_DIAG, _OT_REGION_NET_DIAG_PREFIX aFormat, ##__VA_ARGS__) #else -#define otLogCritNetDiag(aInstance, aFormat, ...) -#define otLogWarnNetDiag(aInstance, aFormat, ...) -#define otLogNoteNetDiag(aInstance, aFormat, ...) -#define otLogInfoNetDiag(aInstance, aFormat, ...) -#define otLogDebgNetDiag(aInstance, aFormat, ...) +#define otLogCritNetDiag(aFormat, ...) +#define otLogWarnNetDiag(aFormat, ...) +#define otLogNoteNetDiag(aFormat, ...) +#define otLogInfoNetDiag(aFormat, ...) +#define otLogDebgNetDiag(aFormat, ...) #endif /** @@ -1138,17 +1027,16 @@ extern "C" { * * This method generates a log with level none for the certification test. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * * */ #if OPENTHREAD_ENABLE_CERT_LOG -#define otLogCertMeshCoP(aInstance, aFormat, ...) \ - _otLogFormatter(&aInstance, OT_LOG_LEVEL_NONE, OT_LOG_REGION_MESH_COP, aFormat, ##__VA_ARGS__) +#define otLogCertMeshCoP(aFormat, ...) \ + _otLogFormatter(OT_LOG_LEVEL_NONE, OT_LOG_REGION_MESH_COP, aFormat, ##__VA_ARGS__) #else -#define otLogCertMeshCoP(aInstance, aFormat, ...) +#define otLogCertMeshCoP(aFormat, ...) #endif /** @@ -1156,7 +1044,6 @@ extern "C" { * * This method generates a log with level critical for the CLI region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -1167,7 +1054,6 @@ extern "C" { * * This method generates a log with level warning for the CLI region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -1178,7 +1064,6 @@ extern "C" { * * This method generates a log with level note for the CLI region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -1189,7 +1074,6 @@ extern "C" { * * This method generates a log with level info for the CLI region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -1200,32 +1084,26 @@ extern "C" { * * This method generates a log with level debug for the CLI region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * */ #if OPENTHREAD_CONFIG_LOG_CLI == 1 -#define otLogCritCli(aInstance, aFormat, ...) \ - otLogCrit(&aInstance, OT_LOG_REGION_CLI, _OT_REGION_CLI_PREFIX aFormat, ##__VA_ARGS__) -#define otLogWarnCli(aInstance, aFormat, ...) \ - otLogWarn(&aInstance, OT_LOG_REGION_CLI, _OT_REGION_CLI_PREFIX aFormat, ##__VA_ARGS__) -#define otLogNoteCli(aInstance, aFormat, ...) \ - otLogNote(&aInstance, OT_LOG_REGION_CLI, _OT_REGION_CLI_PREFIX aFormat, ##__VA_ARGS__) -#define otLogInfoCli(aInstance, aFormat, ...) \ - otLogInfo(&aInstance, OT_LOG_REGION_CLI, _OT_REGION_CLI_PREFIX aFormat, ##__VA_ARGS__) -#define otLogInfoCliErr(aInstance, aError, aFormat, ...) \ - otLogInfo(&aInstance, OT_LOG_REGION_CLI, "Error %s: " aFormat, otThreadErrorToString(aError), ##__VA_ARGS__) -#define otLogDebgCli(aInstance, aFormat, ...) \ - otLogDebg(&aInstance, OT_LOG_REGION_CLI, _OT_REGION_CLI_PREFIX aFormat, ##__VA_ARGS__) +#define otLogCritCli(aFormat, ...) otLogCrit(OT_LOG_REGION_CLI, _OT_REGION_CLI_PREFIX aFormat, ##__VA_ARGS__) +#define otLogWarnCli(aFormat, ...) otLogWarn(OT_LOG_REGION_CLI, _OT_REGION_CLI_PREFIX aFormat, ##__VA_ARGS__) +#define otLogNoteCli(aFormat, ...) otLogNote(OT_LOG_REGION_CLI, _OT_REGION_CLI_PREFIX aFormat, ##__VA_ARGS__) +#define otLogInfoCli(aFormat, ...) otLogInfo(OT_LOG_REGION_CLI, _OT_REGION_CLI_PREFIX aFormat, ##__VA_ARGS__) +#define otLogInfoCliErr(aError, aFormat, ...) \ + otLogInfo(OT_LOG_REGION_CLI, "Error %s: " aFormat, otThreadErrorToString(aError), ##__VA_ARGS__) +#define otLogDebgCli(aFormat, ...) otLogDebg(OT_LOG_REGION_CLI, _OT_REGION_CLI_PREFIX aFormat, ##__VA_ARGS__) #else -#define otLogCritCli(aInstance, aFormat, ...) -#define otLogWarnCli(aInstance, aFormat, ...) -#define otLogNoteCli(aInstance, aFormat, ...) -#define otLogInfoCli(aInstance, aFormat, ...) -#define otLogInfoCliErr(aInstance, aError, aFormat, ...) -#define otLogDebgCli(aInstance, aFormat, ...) +#define otLogCritCli(aFormat, ...) +#define otLogWarnCli(aFormat, ...) +#define otLogNoteCli(aFormat, ...) +#define otLogInfoCli(aFormat, ...) +#define otLogInfoCliErr(aError, aFormat, ...) +#define otLogDebgCli(aFormat, ...) #endif /** @@ -1233,7 +1111,6 @@ extern "C" { * * This method generates a log with level critical for the CoAP region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -1244,7 +1121,6 @@ extern "C" { * * This method generates a log with level warning for the CoAP region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -1255,7 +1131,6 @@ extern "C" { * * This method generates a log with level note for the CoAP region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -1266,7 +1141,6 @@ extern "C" { * * This method generates a log with level info for the CoAP region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -1277,32 +1151,26 @@ extern "C" { * * This method generates a log with level debug for the CoAP region. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * */ #if OPENTHREAD_CONFIG_LOG_COAP == 1 -#define otLogCritCoap(aInstance, aFormat, ...) \ - otLogCrit(&aInstance, OT_LOG_REGION_COAP, _OT_REGION_COAP_PREFIX aFormat, ##__VA_ARGS__) -#define otLogWarnCoap(aInstance, aFormat, ...) \ - otLogWarn(&aInstance, OT_LOG_REGION_COAP, _OT_REGION_COAP_PREFIX aFormat, ##__VA_ARGS__) -#define otLogNoteCoap(aInstance, aFormat, ...) \ - otLogNote(&aInstance, OT_LOG_REGION_COAP, _OT_REGION_COAP_PREFIX aFormat, ##__VA_ARGS__) -#define otLogInfoCoap(aInstance, aFormat, ...) \ - otLogInfo(&aInstance, OT_LOG_REGION_COAP, _OT_REGION_COAP_PREFIX aFormat, ##__VA_ARGS__) -#define otLogInfoCoapErr(aInstance, aError, aFormat, ...) \ - otLogInfo(&aInstance, OT_LOG_REGION_COAP, _OT_REGION_COAP_PREFIX "Error %s: " aFormat, \ - otThreadErrorToString(aError), ##__VA_ARGS__) -#define otLogDebgCoap(aInstance, aFormat, ...) \ - otLogDebg(&aInstance, OT_LOG_REGION_COAP, _OT_REGION_COAP_PREFIX aFormat, ##__VA_ARGS__) +#define otLogCritCoap(aFormat, ...) otLogCrit(OT_LOG_REGION_COAP, _OT_REGION_COAP_PREFIX aFormat, ##__VA_ARGS__) +#define otLogWarnCoap(aFormat, ...) otLogWarn(OT_LOG_REGION_COAP, _OT_REGION_COAP_PREFIX aFormat, ##__VA_ARGS__) +#define otLogNoteCoap(aFormat, ...) otLogNote(OT_LOG_REGION_COAP, _OT_REGION_COAP_PREFIX aFormat, ##__VA_ARGS__) +#define otLogInfoCoap(aFormat, ...) otLogInfo(OT_LOG_REGION_COAP, _OT_REGION_COAP_PREFIX aFormat, ##__VA_ARGS__) +#define otLogInfoCoapErr(aError, aFormat, ...) \ + otLogInfo(OT_LOG_REGION_COAP, _OT_REGION_COAP_PREFIX "Error %s: " aFormat, otThreadErrorToString(aError), \ + ##__VA_ARGS__) +#define otLogDebgCoap(aFormat, ...) otLogDebg(OT_LOG_REGION_COAP, _OT_REGION_COAP_PREFIX aFormat, ##__VA_ARGS__) #else -#define otLogCritCoap(aInstance, aFormat, ...) -#define otLogWarnCoap(aInstance, aFormat, ...) -#define otLogNoteCoap(aInstance, aFormat, ...) -#define otLogInfoCoap(aInstance, aFormat, ...) -#define otLogInfoCoapErr(aInstance, aError, aFormat, ...) -#define otLogDebgCoap(aInstance, aFormat, ...) +#define otLogCritCoap(aFormat, ...) +#define otLogWarnCoap(aFormat, ...) +#define otLogNoteCoap(aFormat, ...) +#define otLogInfoCoap(aFormat, ...) +#define otLogInfoCoapErr(aError, aFormat, ...) +#define otLogDebgCoap(aFormat, ...) #endif /** @@ -1310,7 +1178,6 @@ extern "C" { * * This method generates a log with level critical for the Platform region. * - * @param[in] aInstance A pointer to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -1321,7 +1188,6 @@ extern "C" { * * This method generates a log with level warning for the Platform region. * - * @param[in] aInstance A pointer to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -1332,7 +1198,6 @@ extern "C" { * * This method generates a log with level note for the Platform region. * - * @param[in] aInstance A pointer to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -1343,7 +1208,6 @@ extern "C" { * * This method generates a log with level info for the Platform region. * - * @param[in] aInstance A pointer to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * @@ -1354,27 +1218,22 @@ extern "C" { * * This method generates a log with level debug for the Platform region. * - * @param[in] aInstance A pointer to the OpenThread instance. * @param[in] aFormat A pointer to the format string. * @param[in] ... Arguments for the format specification. * */ #if OPENTHREAD_CONFIG_LOG_PLATFORM == 1 -#define otLogCritPlat(aInstance, aFormat, ...) \ - otLogCrit(aInstance, OT_LOG_REGION_PLATFORM, _OT_REGION_PLATFORM_PREFIX aFormat, ##__VA_ARGS__) -#define otLogWarnPlat(aInstance, aFormat, ...) \ - otLogWarn(aInstance, OT_LOG_REGION_PLATFORM, _OT_REGION_PLATFORM_PREFIX aFormat, ##__VA_ARGS__) -#define otLogNotePlat(aInstance, aFormat, ...) \ - otLogNote(aInstance, OT_LOG_REGION_PLATFORM, _OT_REGION_PLATFORM_PREFIX aFormat, ##__VA_ARGS__) -#define otLogInfoPlat(aInstance, aFormat, ...) \ - otLogInfo(aInstance, OT_LOG_REGION_PLATFORM, _OT_REGION_PLATFORM_PREFIX aFormat, ##__VA_ARGS__) -#define otLogDebgPlat(aInstance, aFormat, ...) \ - otLogDebg(aInstance, OT_LOG_REGION_PLATFORM, _OT_REGION_PLATFORM_PREFIX aFormat, ##__VA_ARGS__) +#define otLogCritPlat(aFormat, ...) otLogCrit(OT_LOG_REGION_PLATFORM, _OT_REGION_PLATFORM_PREFIX aFormat, ##__VA_ARGS__) +#define otLogWarnPlat(aFormat, ...) otLogWarn(OT_LOG_REGION_PLATFORM, _OT_REGION_PLATFORM_PREFIX aFormat, ##__VA_ARGS__) +#define otLogNotePlat(aFormat, ...) otLogNote(OT_LOG_REGION_PLATFORM, _OT_REGION_PLATFORM_PREFIX aFormat, ##__VA_ARGS__) +#define otLogInfoPlat(aFormat, ...) otLogInfo(OT_LOG_REGION_PLATFORM, _OT_REGION_PLATFORM_PREFIX aFormat, ##__VA_ARGS__) +#define otLogDebgPlat(aFormat, ...) otLogDebg(OT_LOG_REGION_PLATFORM, _OT_REGION_PLATFORM_PREFIX aFormat, ##__VA_ARGS__) #else -#define otLogCritPlat(aInstance, aFormat, ...) -#define otLogWarnPlat(aInstance, aFormat, ...) -#define otLogInfoPlat(aInstance, aFormat, ...) -#define otLogDebgPlat(aInstance, aFormat, ...) +#define otLogCritPlat(aFormat, ...) +#define otLogWarnPlat(aFormat, ...) +#define otLogNotePlat(aFormat, ...) +#define otLogInfoPlat(aFormat, ...) +#define otLogDebgPlat(aFormat, ...) #endif #endif // WINDOWS_LOGGING @@ -1384,7 +1243,6 @@ extern "C" { * * This method generates a memory dump with log level critical. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aRegion The log region. * @param[in] aId A pointer to a NULL-terminated string that is printed before the bytes. * @param[in] aBuf A pointer to the buffer. @@ -1392,10 +1250,9 @@ extern "C" { * */ #if OPENTHREAD_CONFIG_LOG_LEVEL >= OT_LOG_LEVEL_CRIT -#define otDumpCrit(aInstance, aRegion, aId, aBuf, aLength) \ - otDump(&aInstance, OT_LOG_LEVEL_CRIT, aRegion, aId, aBuf, aLength) +#define otDumpCrit(aRegion, aId, aBuf, aLength) otDump(OT_LOG_LEVEL_CRIT, aRegion, aId, aBuf, aLength) #else -#define otDumpCrit(aInstance, aRegion, aId, aBuf, aLength) +#define otDumpCrit(aRegion, aId, aBuf, aLength) #endif /** @@ -1403,7 +1260,6 @@ extern "C" { * * This method generates a memory dump with log level warning. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aRegion The log region. * @param[in] aId A pointer to a NULL-terminated string that is printed before the bytes. * @param[in] aBuf A pointer to the buffer. @@ -1411,10 +1267,9 @@ extern "C" { * */ #if OPENTHREAD_CONFIG_LOG_LEVEL >= OT_LOG_LEVEL_WARN -#define otDumpWarn(aInstance, aRegion, aId, aBuf, aLength) \ - otDump(&aInstance, OT_LOG_LEVEL_WARN, aRegion, aId, aBuf, aLength) +#define otDumpWarn(aRegion, aId, aBuf, aLength) otDump(OT_LOG_LEVEL_WARN, aRegion, aId, aBuf, aLength) #else -#define otDumpWarn(aInstance, aRegion, aId, aBuf, aLength) +#define otDumpWarn(aRegion, aId, aBuf, aLength) #endif /** @@ -1422,7 +1277,6 @@ extern "C" { * * This method generates a memory dump with log level note. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aRegion The log region. * @param[in] aId A pointer to a NULL-terminated string that is printed before the bytes. * @param[in] aBuf A pointer to the buffer. @@ -1430,10 +1284,9 @@ extern "C" { * */ #if OPENTHREAD_CONFIG_LOG_LEVEL >= OT_LOG_LEVEL_NOTE -#define otDumpNote(aInstance, aRegion, aId, aBuf, aLength) \ - otDump(&aInstance, OT_LOG_LEVEL_NOTE, aRegion, aId, aBuf, aLength) +#define otDumpNote(aRegion, aId, aBuf, aLength) otDump(OT_LOG_LEVEL_NOTE, aRegion, aId, aBuf, aLength) #else -#define otDumpInfo(aInstance, aRegion, aId, aBuf, aLength) +#define otDumpInfo(aRegion, aId, aBuf, aLength) #endif /** @@ -1441,7 +1294,6 @@ extern "C" { * * This method generates a memory dump with log level info. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aRegion The log region. * @param[in] aId A pointer to a NULL-terminated string that is printed before the bytes. * @param[in] aBuf A pointer to the buffer. @@ -1449,10 +1301,9 @@ extern "C" { * */ #if OPENTHREAD_CONFIG_LOG_LEVEL >= OT_LOG_LEVEL_INFO -#define otDumpInfo(aInstance, aRegion, aId, aBuf, aLength) \ - otDump(&aInstance, OT_LOG_LEVEL_INFO, aRegion, aId, aBuf, aLength) +#define otDumpInfo(aRegion, aId, aBuf, aLength) otDump(OT_LOG_LEVEL_INFO, aRegion, aId, aBuf, aLength) #else -#define otDumpInfo(aInstance, aRegion, aId, aBuf, aLength) +#define otDumpInfo(aRegion, aId, aBuf, aLength) #endif /** @@ -1460,7 +1311,6 @@ extern "C" { * * This method generates a memory dump with log level debug. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aRegion The log region. * @param[in] aId A pointer to a NULL-terminated string that is printed before the bytes. * @param[in] aBuf A pointer to the buffer. @@ -1468,10 +1318,9 @@ extern "C" { * */ #if OPENTHREAD_CONFIG_LOG_LEVEL >= OT_LOG_LEVEL_DEBG -#define otDumpDebg(aInstance, aRegion, aId, aBuf, aLength) \ - otDump(&aInstance, OT_LOG_LEVEL_DEBG, aRegion, aId, aBuf, aLength) +#define otDumpDebg(aRegion, aId, aBuf, aLength) otDump(OT_LOG_LEVEL_DEBG, aRegion, aId, aBuf, aLength) #else -#define otDumpDebg(aInstance, aRegion, aId, aBuf, aLength) +#define otDumpDebg(aRegion, aId, aBuf, aLength) #endif /** @@ -1479,7 +1328,6 @@ extern "C" { * * This method generates a memory dump with log level debug and region Network Data. * - * @param[in] aInstance A reference to the OpenThread instance. * @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. @@ -1491,7 +1339,6 @@ extern "C" { * * This method generates a memory dump with log level warning and region Network Data. * - * @param[in] aInstance A reference to the OpenThread instance. * @param[in] aBuf A pointer to the buffer. * @param[in] aLength Number of bytes to print. * @@ -1500,7 +1347,6 @@ extern "C" { /** * @def otDumpNoteNetData * - * @param[in] aInstance A reference to the OpenThread instance. * @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. @@ -1510,7 +1356,6 @@ extern "C" { /** * @def otDumpInfoNetData * - * @param[in] aInstance A reference to the OpenThread instance. * @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. @@ -1522,29 +1367,23 @@ extern "C" { * * This method generates a memory dump with log level debug and region Network Data. * - * @param[in] aInstance A reference to the OpenThread instance. * @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_NETDATA == 1 -#define otDumpCritNetData(aInstance, aId, aBuf, aLength) \ - otDumpCrit(aInstance, OT_LOG_REGION_NET_DATA, aId, aBuf, aLength) -#define otDumpWarnNetData(aInstance, aId, aBuf, aLength) \ - otDumpWarn(aInstance, OT_LOG_REGION_NET_DATA, aId, aBuf, aLength) -#define otDumpNoteNetData(aInstance, aId, aBuf, aLength) \ - otDumpNote(aInstance, OT_LOG_REGION_NET_DATA, aId, aBuf, aLength) -#define otDumpInfoNetData(aInstance, aId, aBuf, aLength) \ - otDumpInfo(aInstance, OT_LOG_REGION_NET_DATA, aId, aBuf, aLength) -#define otDumpDebgNetData(aInstance, aId, aBuf, aLength) \ - otDumpDebg(aInstance, OT_LOG_REGION_NET_DATA, aId, aBuf, aLength) +#define otDumpCritNetData(aId, aBuf, aLength) otDumpCrit(OT_LOG_REGION_NET_DATA, aId, aBuf, aLength) +#define otDumpWarnNetData(aId, aBuf, aLength) otDumpWarn(OT_LOG_REGION_NET_DATA, aId, aBuf, aLength) +#define otDumpNoteNetData(aId, aBuf, aLength) otDumpNote(OT_LOG_REGION_NET_DATA, aId, aBuf, aLength) +#define otDumpInfoNetData(aId, aBuf, aLength) otDumpInfo(OT_LOG_REGION_NET_DATA, aId, aBuf, aLength) +#define otDumpDebgNetData(aId, aBuf, aLength) otDumpDebg(OT_LOG_REGION_NET_DATA, aId, aBuf, aLength) #else -#define otDumpCritNetData(aInstance, aId, aBuf, aLength) -#define otDumpWarnNetData(aInstance, aId, aBuf, aLength) -#define otDumpNoteNetData(aInstance, aId, aBuf, aLength) -#define otDumpInfoNetData(aInstance, aId, aBuf, aLength) -#define otDumpDebgNetData(aInstance, aId, aBuf, aLength) +#define otDumpCritNetData(aId, aBuf, aLength) +#define otDumpWarnNetData(aId, aBuf, aLength) +#define otDumpNoteNetData(aId, aBuf, aLength) +#define otDumpInfoNetData(aId, aBuf, aLength) +#define otDumpDebgNetData(aId, aBuf, aLength) #endif /** @@ -1552,7 +1391,6 @@ extern "C" { * * This method generates a memory dump with log level debug and region MLE. * - * @param[in] aInstance A reference to the OpenThread instance. * @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. @@ -1564,7 +1402,6 @@ extern "C" { * * This method generates a memory dump with log level warning and region MLE. * - * @param[in] aInstance A reference to the OpenThread instance. * @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. @@ -1576,7 +1413,6 @@ extern "C" { * * This method generates a memory dump with log level note and region MLE. * - * @param[in] aInstance A reference to the OpenThread instance. * @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. @@ -1588,7 +1424,6 @@ extern "C" { * * This method generates a memory dump with log level info and region MLE. * - * @param[in] aInstance A reference to the OpenThread instance. * @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. @@ -1600,24 +1435,23 @@ extern "C" { * * This method generates a memory dump with log level debug and region MLE. * - * @param[in] aInstance A reference to the OpenThread instance. * @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_MLE == 1 -#define otDumpCritMle(aInstance, aId, aBuf, aLength) otDumpCrit(aInstance, OT_LOG_REGION_MLE, aId, aBuf, aLength) -#define otDumpWarnMle(aInstance, aId, aBuf, aLength) otDumpWarn(aInstance, OT_LOG_REGION_MLE, aId, aBuf, aLength) -#define otDumpNoteMle(aInstance, aId, aBuf, aLength) otDumpNote(aInstance, OT_LOG_REGION_MLE, aId, aBuf, aLength) -#define otDumpInfoMle(aInstance, aId, aBuf, aLength) otDumpInfo(aInstance, OT_LOG_REGION_MLE, aId, aBuf, aLength) -#define otDumpDebgMle(aInstance, aId, aBuf, aLength) otDumpDebg(aInstance, OT_LOG_REGION_MLE, aId, aBuf, aLength) +#define otDumpCritMle(aId, aBuf, aLength) otDumpCrit(OT_LOG_REGION_MLE, aId, aBuf, aLength) +#define otDumpWarnMle(aId, aBuf, aLength) otDumpWarn(OT_LOG_REGION_MLE, aId, aBuf, aLength) +#define otDumpNoteMle(aId, aBuf, aLength) otDumpNote(OT_LOG_REGION_MLE, aId, aBuf, aLength) +#define otDumpInfoMle(aId, aBuf, aLength) otDumpInfo(OT_LOG_REGION_MLE, aId, aBuf, aLength) +#define otDumpDebgMle(aId, aBuf, aLength) otDumpDebg(OT_LOG_REGION_MLE, aId, aBuf, aLength) #else -#define otDumpCritMle(aInstance, aId, aBuf, aLength) -#define otDumpWarnMle(aInstance, aId, aBuf, aLength) -#define otDumpNoteMle(aInstance, aId, aBuf, aLength) -#define otDumpInfoMle(aInstance, aId, aBuf, aLength) -#define otDumpDebgMle(aInstance, aId, aBuf, aLength) +#define otDumpCritMle(aId, aBuf, aLength) +#define otDumpWarnMle(aId, aBuf, aLength) +#define otDumpNoteMle(aId, aBuf, aLength) +#define otDumpInfoMle(aId, aBuf, aLength) +#define otDumpDebgMle(aId, aBuf, aLength) #endif /** @@ -1625,7 +1459,6 @@ extern "C" { * * This method generates a memory dump with log level debug and region EID-to-RLOC mapping. * - * @param[in] aInstance A reference to the OpenThread instance. * @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. @@ -1637,7 +1470,6 @@ extern "C" { * * This method generates a memory dump with log level warning and region EID-to-RLOC mapping. * - * @param[in] aInstance A reference to the OpenThread instance. * @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. @@ -1649,7 +1481,6 @@ extern "C" { * * This method generates a memory dump with log level note and region EID-to-RLOC mapping. * - * @param[in] aInstance A reference to the OpenThread instance. * @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. @@ -1661,7 +1492,6 @@ extern "C" { * * This method generates a memory dump with log level info and region EID-to-RLOC mapping. * - * @param[in] aInstance A reference to the OpenThread instance. * @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. @@ -1673,24 +1503,23 @@ extern "C" { * * This method generates a memory dump with log level debug and region EID-to-RLOC mapping. * - * @param[in] aInstance A reference to the OpenThread instance. * @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_ARP == 1 -#define otDumpCritArp(aInstance, aId, aBuf, aLength) otDumpCrit(aInstance, OT_LOG_REGION_ARP, aId, aBuf, aLength) -#define otDumpWarnArp(aInstance, aId, aBuf, aLength) otDumpWarn(aInstance, OT_LOG_REGION_ARP, aId, aBuf, aLength) -#define otDumpNoteArp(aInstance, aId, aBuf, aLength) otDumpNote(aInstance, OT_LOG_REGION_ARP, aId, aBuf, aLength) -#define otDumpInfoArp(aInstance, aId, aBuf, aLength) otDumpInfo(aInstance, OT_LOG_REGION_ARP, aId, aBuf, aLength) -#define otDumpDebgArp(aInstance, aId, aBuf, aLength) otDumpDebg(aInstance, OT_LOG_REGION_ARP, aId, aBuf, aLength) +#define otDumpCritArp(aId, aBuf, aLength) otDumpCrit(OT_LOG_REGION_ARP, aId, aBuf, aLength) +#define otDumpWarnArp(aId, aBuf, aLength) otDumpWarn(OT_LOG_REGION_ARP, aId, aBuf, aLength) +#define otDumpNoteArp(aId, aBuf, aLength) otDumpNote(OT_LOG_REGION_ARP, aId, aBuf, aLength) +#define otDumpInfoArp(aId, aBuf, aLength) otDumpInfo(OT_LOG_REGION_ARP, aId, aBuf, aLength) +#define otDumpDebgArp(aId, aBuf, aLength) otDumpDebg(OT_LOG_REGION_ARP, aId, aBuf, aLength) #else -#define otDumpCritArp(aInstance, aId, aBuf, aLength) -#define otDumpWarnArp(aInstance, aId, aBuf, aLength) -#define otDumpNoteArp(aInstance, aId, aBuf, aLength) -#define otDumpInfoArp(aInstance, aId, aBuf, aLength) -#define otDumpDebgArp(aInstance, aId, aBuf, aLength) +#define otDumpCritArp(aId, aBuf, aLength) +#define otDumpWarnArp(aId, aBuf, aLength) +#define otDumpNoteArp(aId, aBuf, aLength) +#define otDumpInfoArp(aId, aBuf, aLength) +#define otDumpDebgArp(aId, aBuf, aLength) #endif /** @@ -1698,7 +1527,6 @@ extern "C" { * * This method generates a memory dump with log level debug and region ICMPv6. * - * @param[in] aInstance A reference to the OpenThread instance. * @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. @@ -1710,7 +1538,6 @@ extern "C" { * * This method generates a memory dump with log level warning and region ICMPv6. * - * @param[in] aInstance A reference to the OpenThread instance. * @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. @@ -1722,7 +1549,6 @@ extern "C" { * * This method generates a memory dump with log level note and region ICMPv6. * - * @param[in] aInstance A reference to the OpenThread instance. * @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. @@ -1734,7 +1560,6 @@ extern "C" { * * This method generates a memory dump with log level info and region ICMPv6. * - * @param[in] aInstance A reference to the OpenThread instance. * @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. @@ -1746,24 +1571,23 @@ extern "C" { * * This method generates a memory dump with log level debug and region ICMPv6. * - * @param[in] aInstance A reference to the OpenThread instance. * @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_ICMP == 1 -#define otDumpCritIcmp(aInstance, aId, aBuf, aLength) otDumpCrit(aInstance, OT_LOG_REGION_ICMP, aId, aBuf, aLength) -#define otDumpWarnIcmp(aInstance, aId, aBuf, aLength) otDumpWarn(aInstance, OT_LOG_REGION_ICMP, aId, aBuf, aLength) -#define otDumpNoteIcmp(aInstance, aId, aBuf, aLength) otDumpNote(aInstance, OT_LOG_REGION_ICMP, aId, aBuf, aLength) -#define otDumpInfoIcmp(aInstance, aId, aBuf, aLength) otDumpInfo(aInstance, OT_LOG_REGION_ICMP, aId, aBuf, aLength) -#define otDumpDebgIcmp(aInstance, aId, aBuf, aLength) otDumpDebg(aInstance, OT_LOG_REGION_ICMP, aId, aBuf, aLength) +#define otDumpCritIcmp(aId, aBuf, aLength) otDumpCrit(OT_LOG_REGION_ICMP, aId, aBuf, aLength) +#define otDumpWarnIcmp(aId, aBuf, aLength) otDumpWarn(OT_LOG_REGION_ICMP, aId, aBuf, aLength) +#define otDumpNoteIcmp(aId, aBuf, aLength) otDumpNote(OT_LOG_REGION_ICMP, aId, aBuf, aLength) +#define otDumpInfoIcmp(aId, aBuf, aLength) otDumpInfo(OT_LOG_REGION_ICMP, aId, aBuf, aLength) +#define otDumpDebgIcmp(aId, aBuf, aLength) otDumpDebg(OT_LOG_REGION_ICMP, aId, aBuf, aLength) #else -#define otDumpCritIcmp(aInstance, aId, aBuf, aLength) -#define otDumpWarnIcmp(aInstance, aId, aBuf, aLength) -#define otDumpNoteIcmp(aInstance, aId, aBuf, aLength) -#define otDumpInfoIcmp(aInstance, aId, aBuf, aLength) -#define otDumpDebgIcmp(aInstance, aId, aBuf, aLength) +#define otDumpCritIcmp(aId, aBuf, aLength) +#define otDumpWarnIcmp(aId, aBuf, aLength) +#define otDumpNoteIcmp(aId, aBuf, aLength) +#define otDumpInfoIcmp(aId, aBuf, aLength) +#define otDumpDebgIcmp(aId, aBuf, aLength) #endif /** @@ -1771,7 +1595,6 @@ extern "C" { * * This method generates a memory dump with log level debug and region IPv6. * - * @param[in] aInstance A reference to the OpenThread instance. * @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. @@ -1783,7 +1606,6 @@ extern "C" { * * This method generates a memory dump with log level warning and region IPv6. * - * @param[in] aInstance A reference to the OpenThread instance. * @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. @@ -1795,7 +1617,6 @@ extern "C" { * * This method generates a memory dump with log level note and region IPv6. * - * @param[in] aInstance A reference to the OpenThread instance. * @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. @@ -1807,7 +1628,6 @@ extern "C" { * * This method generates a memory dump with log level info and region IPv6. * - * @param[in] aInstance A reference to the OpenThread instance. * @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. @@ -1819,24 +1639,23 @@ extern "C" { * * This method generates a memory dump with log level debug and region IPv6. * - * @param[in] aInstance A reference to the OpenThread instance. * @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_IP6 == 1 -#define otDumpCritIp6(aInstance, aId, aBuf, aLength) otDumpCrit(aInstance, OT_LOG_REGION_IP6, aId, aBuf, aLength) -#define otDumpWarnIp6(aInstance, aId, aBuf, aLength) otDumpWarn(aInstance, OT_LOG_REGION_IP6, aId, aBuf, aLength) -#define otDumpNoteIp6(aInstance, aId, aBuf, aLength) otDumpNote(aInstance, OT_LOG_REGION_IP6, aId, aBuf, aLength) -#define otDumpInfoIp6(aInstance, aId, aBuf, aLength) otDumpInfo(aInstance, OT_LOG_REGION_IP6, aId, aBuf, aLength) -#define otDumpDebgIp6(aInstance, aId, aBuf, aLength) otDumpDebg(aInstance, OT_LOG_REGION_IP6, aId, aBuf, aLength) +#define otDumpCritIp6(aId, aBuf, aLength) otDumpCrit(OT_LOG_REGION_IP6, aId, aBuf, aLength) +#define otDumpWarnIp6(aId, aBuf, aLength) otDumpWarn(OT_LOG_REGION_IP6, aId, aBuf, aLength) +#define otDumpNoteIp6(aId, aBuf, aLength) otDumpNote(OT_LOG_REGION_IP6, aId, aBuf, aLength) +#define otDumpInfoIp6(aId, aBuf, aLength) otDumpInfo(OT_LOG_REGION_IP6, aId, aBuf, aLength) +#define otDumpDebgIp6(aId, aBuf, aLength) otDumpDebg(OT_LOG_REGION_IP6, aId, aBuf, aLength) #else -#define otDumpCritIp6(aInstance, aId, aBuf, aLength) -#define otDumpWarnIp6(aInstance, aId, aBuf, aLength) -#define otDumpNoteIp6(aInstance, aId, aBuf, aLength) -#define otDumpInfoIp6(aInstance, aId, aBuf, aLength) -#define otDumpDebgIp6(aInstance, aId, aBuf, aLength) +#define otDumpCritIp6(aId, aBuf, aLength) +#define otDumpWarnIp6(aId, aBuf, aLength) +#define otDumpNoteIp6(aId, aBuf, aLength) +#define otDumpInfoIp6(aId, aBuf, aLength) +#define otDumpDebgIp6(aId, aBuf, aLength) #endif /** @@ -1844,7 +1663,6 @@ extern "C" { * * This method generates a memory dump with log level debug and region MAC. * - * @param[in] aInstance A reference to the OpenThread instance. * @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. @@ -1856,7 +1674,6 @@ extern "C" { * * This method generates a memory dump with log level warning and region MAC. * - * @param[in] aInstance A reference to the OpenThread instance. * @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. @@ -1868,7 +1685,6 @@ extern "C" { * * This method generates a memory dump with log level note and region MAC. * - * @param[in] aInstance A reference to the OpenThread instance. * @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. @@ -1880,7 +1696,6 @@ extern "C" { * * This method generates a memory dump with log level info and region MAC. * - * @param[in] aInstance A reference to the OpenThread instance. * @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. @@ -1892,24 +1707,23 @@ extern "C" { * * This method generates a memory dump with log level debug and region MAC. * - * @param[in] aInstance A reference to the OpenThread instance. * @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_MAC == 1 -#define otDumpCritMac(aInstance, aId, aBuf, aLength) otDumpCrit(aInstance, OT_LOG_REGION_MAC, aId, aBuf, aLength) -#define otDumpWarnMac(aInstance, aId, aBuf, aLength) otDumpWarn(aInstance, OT_LOG_REGION_MAC, aId, aBuf, aLength) -#define otDumpNoteMac(aInstance, aId, aBuf, aLength) otDumpNote(aInstance, OT_LOG_REGION_MAC, aId, aBuf, aLength) -#define otDumpInfoMac(aInstance, aId, aBuf, aLength) otDumpInfo(aInstance, OT_LOG_REGION_MAC, aId, aBuf, aLength) -#define otDumpDebgMac(aInstance, aId, aBuf, aLength) otDumpDebg(aInstance, OT_LOG_REGION_MAC, aId, aBuf, aLength) +#define otDumpCritMac(aId, aBuf, aLength) otDumpCrit(OT_LOG_REGION_MAC, aId, aBuf, aLength) +#define otDumpWarnMac(aId, aBuf, aLength) otDumpWarn(OT_LOG_REGION_MAC, aId, aBuf, aLength) +#define otDumpNoteMac(aId, aBuf, aLength) otDumpNote(OT_LOG_REGION_MAC, aId, aBuf, aLength) +#define otDumpInfoMac(aId, aBuf, aLength) otDumpInfo(OT_LOG_REGION_MAC, aId, aBuf, aLength) +#define otDumpDebgMac(aId, aBuf, aLength) otDumpDebg(OT_LOG_REGION_MAC, aId, aBuf, aLength) #else -#define otDumpCritMac(aInstance, aId, aBuf, aLength) -#define otDumpWarnMac(aInstance, aId, aBuf, aLength) -#define otDumpNoteMac(aInstance, aId, aBuf, aLength) -#define otDumpInfoMac(aInstance, aId, aBuf, aLength) -#define otDumpDebgMac(aInstance, aId, aBuf, aLength) +#define otDumpCritMac(aId, aBuf, aLength) +#define otDumpWarnMac(aId, aBuf, aLength) +#define otDumpNoteMac(aId, aBuf, aLength) +#define otDumpInfoMac(aId, aBuf, aLength) +#define otDumpDebgMac(aId, aBuf, aLength) #endif /** @@ -1917,7 +1731,6 @@ extern "C" { * * This method generates a memory dump with log level debug and region Core. * - * @param[in] aInstance A reference to the OpenThread instance. * @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. @@ -1929,7 +1742,6 @@ extern "C" { * * This method generates a memory dump with log level warning and region Core. * - * @param[in] aInstance A reference to the OpenThread instance. * @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. @@ -1941,7 +1753,6 @@ extern "C" { * * This method generates a memory dump with log level note and region Core. * - * @param[in] aInstance A reference to the OpenThread instance. * @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. @@ -1953,7 +1764,6 @@ extern "C" { * * This method generates a memory dump with log level info and region Core. * - * @param[in] aInstance A reference to the OpenThread instance. * @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. @@ -1965,24 +1775,23 @@ extern "C" { * * This method generates a memory dump with log level debug and region Core. * - * @param[in] aInstance A reference to the OpenThread instance. * @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_CORE == 1 -#define otDumpCritCore(aInstance, aId, aBuf, aLength) otDumpCrit(aInstance, OT_LOG_REGION_CORE, aId, aBuf, aLength) -#define otDumpWarnCore(aInstance, aId, aBuf, aLength) otDumpWarn(aInstance, OT_LOG_REGION_CORE, aId, aBuf, aLength) -#define otDumpNoteCore(aInstance, aId, aBuf, aLength) otDumpNote(aInstance, OT_LOG_REGION_CORE, aId, aBuf, aLength) -#define otDumpInfoCore(aInstance, aId, aBuf, aLength) otDumpInfo(aInstance, OT_LOG_REGION_CORE, aId, aBuf, aLength) -#define otDumpDebgCore(aInstance, aId, aBuf, aLength) otDumpDebg(aInstance, OT_LOG_REGION_CORE, aId, aBuf, aLength) +#define otDumpCritCore(aId, aBuf, aLength) otDumpCrit(OT_LOG_REGION_CORE, aId, aBuf, aLength) +#define otDumpWarnCore(aId, aBuf, aLength) otDumpWarn(OT_LOG_REGION_CORE, aId, aBuf, aLength) +#define otDumpNoteCore(aId, aBuf, aLength) otDumpNote(OT_LOG_REGION_CORE, aId, aBuf, aLength) +#define otDumpInfoCore(aId, aBuf, aLength) otDumpInfo(OT_LOG_REGION_CORE, aId, aBuf, aLength) +#define otDumpDebgCore(aId, aBuf, aLength) otDumpDebg(OT_LOG_REGION_CORE, aId, aBuf, aLength) #else -#define otDumpCritCore(aInstance, aId, aBuf, aLength) -#define otDumpWarnCore(aInstance, aId, aBuf, aLength) -#define otDumpNoteCore(aInstance, aId, aBuf, aLength) -#define otDumpInfoCore(aInstance, aId, aBuf, aLength) -#define otDumpDebgCore(aInstance, aId, aBuf, aLength) +#define otDumpCritCore(aId, aBuf, aLength) +#define otDumpWarnCore(aId, aBuf, aLength) +#define otDumpNoteCore(aId, aBuf, aLength) +#define otDumpInfoCore(aId, aBuf, aLength) +#define otDumpDebgCore(aId, aBuf, aLength) #endif /** @@ -1990,7 +1799,6 @@ extern "C" { * * This method generates a memory dump with log level debug and region memory. * - * @param[in] aInstance A reference to the OpenThread instance. * @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. @@ -2002,7 +1810,6 @@ extern "C" { * * This method generates a memory dump with log level warning and region memory. * - * @param[in] aInstance A reference to the OpenThread instance. * @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. @@ -2014,7 +1821,6 @@ extern "C" { * * This method generates a memory dump with log level note and region memory. * - * @param[in] aInstance A reference to the OpenThread instance. * @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. @@ -2026,7 +1832,6 @@ extern "C" { * * This method generates a memory dump with log level info and region memory. * - * @param[in] aInstance A reference to the OpenThread instance. * @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. @@ -2038,24 +1843,23 @@ extern "C" { * * This method generates a memory dump with log level debug and region memory. * - * @param[in] aInstance A reference to the OpenThread instance. * @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_MEM == 1 -#define otDumpCritMem(aInstance, aId, aBuf, aLength) otDumpCrit(aInstance, OT_LOG_REGION_MEM, aId, aBuf, aLength) -#define otDumpWarnMem(aInstance, aId, aBuf, aLength) otDumpWarn(aInstance, OT_LOG_REGION_MEM, aId, aBuf, aLength) -#define otDumpNoteMem(aInstance, aId, aBuf, aLength) otDumpNote(aInstance, OT_LOG_REGION_MEM, aId, aBuf, aLength) -#define otDumpInfoMem(aInstance, aId, aBuf, aLength) otDumpInfo(aInstance, OT_LOG_REGION_MEM, aId, aBuf, aLength) -#define otDumpDebgMem(aInstance, aId, aBuf, aLength) otDumpDebg(aInstance, OT_LOG_REGION_MEM, aId, aBuf, aLength) +#define otDumpCritMem(aId, aBuf, aLength) otDumpCrit(OT_LOG_REGION_MEM, aId, aBuf, aLength) +#define otDumpWarnMem(aId, aBuf, aLength) otDumpWarn(OT_LOG_REGION_MEM, aId, aBuf, aLength) +#define otDumpNoteMem(aId, aBuf, aLength) otDumpNote(OT_LOG_REGION_MEM, aId, aBuf, aLength) +#define otDumpInfoMem(aId, aBuf, aLength) otDumpInfo(OT_LOG_REGION_MEM, aId, aBuf, aLength) +#define otDumpDebgMem(aId, aBuf, aLength) otDumpDebg(OT_LOG_REGION_MEM, aId, aBuf, aLength) #else -#define otDumpCritMem(aInstance, aId, aBuf, aLength) -#define otDumpWarnMem(aInstance, aId, aBuf, aLength) -#define otDumpNoteMem(aInstance, aId, aBuf, aLength) -#define otDumpInfoMem(aInstance, aId, aBuf, aLength) -#define otDumpDebgMem(aInstance, aId, aBuf, aLength) +#define otDumpCritMem(aId, aBuf, aLength) +#define otDumpWarnMem(aId, aBuf, aLength) +#define otDumpNoteMem(aId, aBuf, aLength) +#define otDumpInfoMem(aId, aBuf, aLength) +#define otDumpDebgMem(aId, aBuf, aLength) #endif /** @@ -2063,23 +1867,20 @@ extern "C" { * * This method generates a memory dump with log level none for the certification test. * - * @param[in] aInstance A reference to the OpenThread instance. * @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_ENABLE_CERT_LOG -#define otDumpCertMeshCoP(aInstance, aId, aBuf, aLength) \ - otDump(&aInstance, OT_LOG_LEVEL_NONE, OT_LOG_REGION_MESH_COP, aId, aBuf, aLength) +#define otDumpCertMeshCoP(aId, aBuf, aLength) otDump(OT_LOG_LEVEL_NONE, OT_LOG_REGION_MESH_COP, aId, aBuf, aLength) #else -#define otDumpCertMeshCoP(aInstance, aId, aBuf, aLength) +#define otDumpCertMeshCoP(aId, aBuf, aLength) #endif /** * This method dumps bytes to the log in a human-readable fashion. * - * @param[in] aInstance A pointer to the instance. * @param[in] aLevel The log level. * @param[in] aRegion The log region. * @param[in] aId A pointer to a NULL-terminated string that is printed before the bytes. @@ -2087,12 +1888,7 @@ extern "C" { * @param[in] aLength Number of bytes to print. * */ -void otDump(otInstance * aIntsance, - otLogLevel aLevel, - otLogRegion aRegion, - const char * aId, - const void * aBuf, - const size_t aLength); +void otDump(otLogLevel aLevel, otLogRegion aRegion, const char *aId, const void *aBuf, const size_t aLength); /** * This function converts a log level to a prefix string for appending to log message. @@ -2107,25 +1903,24 @@ const char *otLogLevelToPrefixString(otLogLevel aLogLevel); /** * Local/private macro to format the log message */ -#define _otLogFormatter(aInstance, aLogLevel, aRegion, aFormat, ...) \ - _otDynamicLog(aInstance, aLogLevel, aRegion, aFormat OPENTHREAD_CONFIG_LOG_SUFFIX, ##__VA_ARGS__) +#define _otLogFormatter(aLogLevel, aRegion, aFormat, ...) \ + _otDynamicLog(aLogLevel, aRegion, aFormat OPENTHREAD_CONFIG_LOG_SUFFIX, ##__VA_ARGS__) #if OPENTHREAD_CONFIG_ENABLE_DYNAMIC_LOG_LEVEL == 1 /** * Local/private macro to dynamically filter log level. */ -#define _otDynamicLog(aInstance, aLogLevel, aRegion, aFormat, ...) \ +#define _otDynamicLog(aLogLevel, aRegion, aFormat, ...) \ do \ { \ - if (otGetDynamicLogLevel(aInstance) >= aLogLevel) \ + if (otLoggingGetLevel() >= aLogLevel) \ _otPlatLog(aLogLevel, aRegion, aFormat, ##__VA_ARGS__); \ } while (false) #else // OPENTHREAD_CONFIG_ENABLE_DYNAMIC_LOG_LEVEL -#define _otDynamicLog(aInstance, aLogLevel, aRegion, aFormat, ...) \ - _otPlatLog(aLogLevel, aRegion, aFormat, ##__VA_ARGS__) +#define _otDynamicLog(aLogLevel, aRegion, aFormat, ...) _otPlatLog(aLogLevel, aRegion, aFormat, ##__VA_ARGS__) #endif // OPENTHREAD_CONFIG_ENABLE_DYNAMIC_LOG_LEVEL diff --git a/src/core/common/message.cpp b/src/core/common/message.cpp index 40cd1c861..1f056f519 100644 --- a/src/core/common/message.cpp +++ b/src/core/common/message.cpp @@ -124,7 +124,7 @@ Buffer *MessagePool::NewBuffer(uint8_t aPriority) if (buffer == NULL) { - otLogInfoMem(GetInstance(), "No available message buffer"); + otLogInfoMem("No available message buffer"); } exit: diff --git a/src/core/common/notifier.cpp b/src/core/common/notifier.cpp index da772e6e7..d28499dc4 100644 --- a/src/core/common/notifier.cpp +++ b/src/core/common/notifier.cpp @@ -223,7 +223,7 @@ void Notifier::LogChangedFlags(otChangedFlags aFlags) const } exit: - otLogInfoCore(GetInstance(), "Notifier: StateChanged (0x%04x) [%s] ", aFlags, string.AsCString()); + otLogInfoCore("Notifier: StateChanged (0x%04x) [%s] ", aFlags, string.AsCString()); } const char *Notifier::FlagToString(otChangedFlags aFlag) const diff --git a/src/core/common/settings.cpp b/src/core/common/settings.cpp index d193a56a0..1212eed99 100644 --- a/src/core/common/settings.cpp +++ b/src/core/common/settings.cpp @@ -50,14 +50,12 @@ namespace ot { void SettingsBase::LogNetworkInfo(const char *aAction, const NetworkInfo &aNetworkInfo) const { - otLogInfoCore(GetInstance(), - "Non-volatile: %s NetworkInfo {rloc:0x%04x, extaddr:%s, role:%s, mode:0x%02x, keyseq:0x%x, ...", + otLogInfoCore("Non-volatile: %s NetworkInfo {rloc:0x%04x, extaddr:%s, role:%s, mode:0x%02x, keyseq:0x%x, ...", aAction, aNetworkInfo.mRloc16, aNetworkInfo.mExtAddress.ToString().AsCString(), Mle::Mle::RoleToString(static_cast(aNetworkInfo.mRole)), aNetworkInfo.mDeviceMode, aNetworkInfo.mKeySequence); - otLogInfoCore(GetInstance(), - "Non-volatile: ... pid:0x%x, mlecntr:0x%x, maccntr:0x%x, mliid:%02x%02x%02x%02x%02x%02x%02x%02x}", + otLogInfoCore("Non-volatile: ... pid:0x%x, mlecntr:0x%x, maccntr:0x%x, mliid:%02x%02x%02x%02x%02x%02x%02x%02x}", aNetworkInfo.mPreviousPartitionId, aNetworkInfo.mMleFrameCounter, aNetworkInfo.mMacFrameCounter, aNetworkInfo.mMlIid[0], aNetworkInfo.mMlIid[1], aNetworkInfo.mMlIid[2], aNetworkInfo.mMlIid[3], aNetworkInfo.mMlIid[4], aNetworkInfo.mMlIid[5], aNetworkInfo.mMlIid[6], aNetworkInfo.mMlIid[7]); @@ -65,14 +63,13 @@ void SettingsBase::LogNetworkInfo(const char *aAction, const NetworkInfo &aNetwo void SettingsBase::LogParentInfo(const char *aAction, const ParentInfo &aParentInfo) const { - otLogInfoCore(GetInstance(), "Non-volatile: %s ParentInfo {extaddr:%s}", aAction, - aParentInfo.mExtAddress.ToString().AsCString()); + otLogInfoCore("Non-volatile: %s ParentInfo {extaddr:%s}", aAction, aParentInfo.mExtAddress.ToString().AsCString()); } void SettingsBase::LogChildInfo(const char *aAction, const ChildInfo &aChildInfo) const { - otLogInfoCore(GetInstance(), "Non-volatile: %s ChildInfo {rloc:0x%04x, extaddr:%s, timeout:%u, mode:0x%02x}", - aAction, aChildInfo.mRloc16, aChildInfo.mExtAddress.ToString().AsCString(), aChildInfo.mTimeout, + otLogInfoCore("Non-volatile: %s ChildInfo {rloc:0x%04x, extaddr:%s, timeout:%u, mode:0x%02x}", aAction, + aChildInfo.mRloc16, aChildInfo.mExtAddress.ToString().AsCString(), aChildInfo.mTimeout, aChildInfo.mMode); } @@ -84,7 +81,7 @@ void SettingsBase::LogFailure(otError error, const char *aText, bool aIsDelete) { if ((error != OT_ERROR_NONE) && (!aIsDelete || (error != OT_ERROR_NOT_FOUND))) { - otLogWarnCore(GetInstance(), "Non-volatile: Error %s %s", otThreadErrorToString(error), aText); + otLogWarnCore("Non-volatile: Error %s %s", otThreadErrorToString(error), aText); } } @@ -99,7 +96,7 @@ void Settings::Init(void) void Settings::Wipe(void) { otPlatSettingsWipe(&GetInstance()); - otLogInfoCore(GetInstance(), "Non-volatile: Wiped all info"); + otLogInfoCore("Non-volatile: Wiped all info"); } otError Settings::SaveOperationalDataset(bool aIsActive, const MeshCoP::Dataset &aDataset) @@ -160,7 +157,7 @@ otError Settings::DeleteNetworkInfo(void) otError error; SuccessOrExit(error = Delete(kKeyNetworkInfo)); - otLogInfoCore(GetInstance(), "Non-volatile: Deleted NetworkInfo"); + otLogInfoCore("Non-volatile: Deleted NetworkInfo"); exit: LogFailure(error, "deleting NetworkInfo", true); @@ -195,7 +192,7 @@ otError Settings::DeleteParentInfo(void) otError error; SuccessOrExit(error = Delete(kKeyParentInfo)); - otLogInfoCore(GetInstance(), "Non-volatile: Deleted ParentInfo"); + otLogInfoCore("Non-volatile: Deleted ParentInfo"); exit: LogFailure(error, "deleting ParentInfo", true); @@ -219,7 +216,7 @@ otError Settings::DeleteChildInfo(void) otError error; SuccessOrExit(error = Delete(kKeyChildInfo)); - otLogInfoCore(GetInstance(), "Non-volatile: Deleted all ChildInfo"); + otLogInfoCore("Non-volatile: Deleted all ChildInfo"); exit: LogFailure(error, "deleting all ChildInfo", true); diff --git a/src/core/mac/link_raw.cpp b/src/core/mac/link_raw.cpp index fc96af61c..d295ce62c 100644 --- a/src/core/mac/link_raw.cpp +++ b/src/core/mac/link_raw.cpp @@ -77,7 +77,7 @@ otError LinkRaw::SetEnabled(bool aEnabled) { otError error = OT_ERROR_NONE; - otLogInfoPlat(&mInstance, "LinkRaw Enabled=%d", aEnabled ? 1 : 0); + otLogInfoPlat("LinkRaw Enabled=%d", aEnabled ? 1 : 0); #if OPENTHREAD_MTD || OPENTHREAD_FTD VerifyOrExit(!static_cast(mInstance).GetThreadNetif().IsUp(), error = OT_ERROR_INVALID_STATE); @@ -214,12 +214,12 @@ void LinkRaw::InvokeReceiveDone(otRadioFrame *aFrame, otError aError) { if (aError == OT_ERROR_NONE) { - otLogInfoPlat(&mInstance, "LinkRaw Invoke Receive Done (%d bytes)", aFrame->mLength); + otLogInfoPlat("LinkRaw Invoke Receive Done (%d bytes)", aFrame->mLength); mReceiveDoneCallback(&mInstance, aFrame, aError); } else { - otLogWarnPlat(&mInstance, "LinkRaw Invoke Receive Done (err=0x%x)", aError); + otLogWarnPlat("LinkRaw Invoke Receive Done (err=0x%x)", aError); } } } @@ -258,7 +258,7 @@ otError LinkRaw::Transmit(otRadioFrame *aFrame, otLinkRawTransmitDone aCallback) void LinkRaw::InvokeTransmitDone(otRadioFrame *aFrame, otRadioFrame *aAckFrame, otError aError) { - otLogDebgPlat(&mInstance, "LinkRaw Transmit Done (err=0x%x)", aError); + otLogDebgPlat("LinkRaw Transmit Done (err=0x%x)", aError); #if OPENTHREAD_CONFIG_ENABLE_SOFTWARE_ACK_TIMEOUT mTimer.Stop(); @@ -320,11 +320,11 @@ void LinkRaw::InvokeTransmitDone(otRadioFrame *aFrame, otRadioFrame *aAckFrame, { if (aError == OT_ERROR_NONE) { - otLogInfoPlat(&mInstance, "LinkRaw Invoke Transmit Done"); + otLogInfoPlat("LinkRaw Invoke Transmit Done"); } else { - otLogWarnPlat(&mInstance, "LinkRaw Invoke Transmit Failed (err=0x%x)", aError); + otLogWarnPlat("LinkRaw Invoke Transmit Failed (err=0x%x)", aError); } mTransmitDoneCallback(&mInstance, aFrame, aAckFrame, aError); @@ -390,7 +390,7 @@ void LinkRaw::TransmitStarted(otRadioFrame *aFrame) if (static_cast(aFrame)->GetAckRequest() && !(otPlatRadioGetCaps(&mInstance) & OT_RADIO_CAPS_ACK_TIMEOUT)) { - otLogDebgPlat(&mInstance, "LinkRaw Starting AckTimeout Timer"); + otLogDebgPlat("LinkRaw Starting AckTimeout Timer"); mTimerReason = kTimerReasonAckTimeout; mTimer.Start(Mac::kAckTimeout); } @@ -492,7 +492,7 @@ void LinkRaw::StartCsmaBackoff(void) backoff = Random::GetUint32InRange(0, 1U << backoffExponent); backoff *= (static_cast(Mac::kUnitBackoffPeriod) * OT_RADIO_SYMBOL_TIME); - otLogDebgPlat(&mInstance, "LinkRaw Starting RetransmitTimeout Timer (%d ms)", backoff); + otLogDebgPlat("LinkRaw Starting RetransmitTimeout Timer (%d ms)", backoff); mTimerReason = kTimerReasonCsmaBackoffComplete; #if OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER diff --git a/src/core/mac/mac.cpp b/src/core/mac/mac.cpp index 600d2f94c..1cbae974b 100644 --- a/src/core/mac/mac.cpp +++ b/src/core/mac/mac.cpp @@ -697,7 +697,7 @@ void Mac::UpdateIdleMode(void) { if (RadioSleep() != OT_ERROR_INVALID_STATE) { - otLogDebgMac(GetInstance(), "Idle mode: Radio sleeping"); + otLogDebgMac("Idle mode: Radio sleeping"); ExitNow(); } @@ -706,7 +706,7 @@ void Mac::UpdateIdleMode(void) // the radio in receive mode. } - otLogDebgMac(GetInstance(), "Idle mode: Radio receiving on channel %d", mRadioChannel); + otLogDebgMac("Idle mode: Radio receiving on channel %d", mRadioChannel); RadioReceive(mRadioChannel); exit: @@ -717,7 +717,7 @@ void Mac::StartOperation(Operation aOperation) { if (aOperation != kOperationIdle) { - otLogDebgMac(GetInstance(), "Request to start operation \"%s\"", OperationToString(aOperation)); + otLogDebgMac("Request to start operation \"%s\"", OperationToString(aOperation)); } switch (aOperation) @@ -843,7 +843,7 @@ void Mac::PerformOperation(void) if (mOperation != kOperationIdle) { - otLogDebgMac(GetInstance(), "Starting operation \"%s\"", OperationToString(mOperation)); + otLogDebgMac("Starting operation \"%s\"", OperationToString(mOperation)); } exit: @@ -854,7 +854,7 @@ void Mac::FinishOperation(void) { // Clear the current operation and start any pending ones. - otLogDebgMac(GetInstance(), "Finishing operation \"%s\"", OperationToString(mOperation)); + otLogDebgMac("Finishing operation \"%s\"", OperationToString(mOperation)); mOperation = kOperationIdle; @@ -895,7 +895,7 @@ void Mac::SendBeaconRequest(Frame &aFrame) aFrame.SetDstPanId(kShortAddrBroadcast); aFrame.SetDstAddr(kShortAddrBroadcast); aFrame.SetCommandId(Frame::kMacCmdBeaconRequest); - otLogInfoMac(GetInstance(), "Sending Beacon Request"); + otLogInfoMac("Sending Beacon Request"); } void Mac::SendBeacon(Frame &aFrame) @@ -1289,7 +1289,7 @@ void Mac::HandleTransmitStarted(otRadioFrame *aFrame) if (frame->GetAckRequest() && !(otPlatRadioGetCaps(&GetInstance()) & OT_RADIO_CAPS_ACK_TIMEOUT)) { mMacTimer.Start(kAckTimeout); - otLogDebgMac(GetInstance(), "Ack timer start"); + otLogDebgMac("Ack timer start"); } } @@ -1417,7 +1417,7 @@ void Mac::HandleTransmitDone(otRadioFrame *aFrame, otRadioFrame *aAckFrame, otEr { LogFrameTxFailure(sendFrame, aError); - otDumpDebgMac(GetInstance(), "TX ERR", sendFrame.GetHeader(), 16); + otDumpDebgMac("TX ERR", sendFrame.GetHeader(), 16); if (mEnabled && !RadioSupportsRetries() && mTransmitRetries < sendFrame.GetMaxFrameRetries()) { @@ -1534,7 +1534,7 @@ void Mac::HandleTransmitDone(otRadioFrame *aFrame, otRadioFrame *aAckFrame, otEr mDataSequence++; } - otDumpDebgMac(GetInstance(), "TX", sendFrame.GetHeader(), sendFrame.GetLength()); + otDumpDebgMac("TX", sendFrame.GetHeader(), sendFrame.GetLength()); sender->HandleSentFrame(sendFrame, aError); FinishOperation(); break; @@ -1577,7 +1577,7 @@ exit: if (error != OT_ERROR_NONE) { - otLogWarnMac(GetInstance(), "otPlatRadioTransmit() failed with error %s", otThreadErrorToString(error)); + otLogWarnMac("otPlatRadioTransmit() failed with error %s", otThreadErrorToString(error)); } return error; @@ -1603,7 +1603,7 @@ exit: if (error != OT_ERROR_NONE) { - otLogWarnMac(GetInstance(), "otPlatRadioReceive() failed with error %s", otThreadErrorToString(error)); + otLogWarnMac("otPlatRadioReceive() failed with error %s", otThreadErrorToString(error)); } return error; @@ -1617,7 +1617,7 @@ otError Mac::RadioSleep(void) if (mDelaySleep) { - otLogDebgMac(GetInstance(), "Delaying sleep waiting for frame rx/tx"); + otLogDebgMac("Delaying sleep waiting for frame rx/tx"); mReceiveTimer.Start(kSleepDelay); mDelaySleep = false; @@ -1634,7 +1634,7 @@ otError Mac::RadioSleep(void) error = otPlatRadioSleep(&GetInstance()); VerifyOrExit(error != OT_ERROR_NONE); - otLogWarnMac(GetInstance(), "otPlatRadioSleep() failed with error %s", otThreadErrorToString(error)); + otLogWarnMac("otPlatRadioSleep() failed with error %s", otThreadErrorToString(error)); exit: return error; @@ -1659,7 +1659,7 @@ void Mac::HandleMacTimer(void) break; case kOperationTransmitData: - otLogDebgMac(GetInstance(), "Ack timer fired"); + otLogDebgMac("Ack timer fired"); RadioReceive(mTxFrame->mChannel); HandleTransmitDone(mTxFrame, NULL, OT_ERROR_NO_ACK); break; @@ -1685,7 +1685,7 @@ void Mac::HandleReceiveTimer(void) if (mOperation == kOperationWaitingForData) { - otLogDebgMac(GetInstance(), "Data poll timeout"); + otLogDebgMac("Data poll timeout"); FinishOperation(); @@ -1696,7 +1696,7 @@ void Mac::HandleReceiveTimer(void) } else { - otLogDebgMac(GetInstance(), "Sleep delay timeout expired"); + otLogDebgMac("Sleep delay timeout expired"); UpdateIdleMode(); } @@ -1725,7 +1725,7 @@ otError Mac::ProcessReceiveSecurity(Frame &aFrame, const Address &aSrcAddr, Neig aFrame.GetSecurityLevel(securityLevel); aFrame.GetFrameCounter(frameCounter); - otLogDebgMac(GetInstance(), "Frame counter %u", frameCounter); + otLogDebgMac("Frame counter %u", frameCounter); aFrame.GetKeyIdMode(keyIdMode); @@ -1935,7 +1935,7 @@ void Mac::HandleReceivedFrame(Frame *aFrame, otError aError) break; case Address::kTypeShort: - otLogDebgMac(GetInstance(), "Received frame from short address 0x%04x", srcaddr.GetShort()); + otLogDebgMac("Received frame from short address 0x%04x", srcaddr.GetShort()); if (neighbor == NULL) { @@ -2130,7 +2130,7 @@ void Mac::HandleReceivedFrame(Frame *aFrame, otError aError) if (receive) { - otDumpDebgMac(GetInstance(), "RX", aFrame->GetHeader(), aFrame->GetLength()); + otDumpDebgMac("RX", aFrame->GetHeader(), aFrame->GetLength()); for (Receiver *receiver = mReceiveHead; receiver; receiver = receiver->mNext) { @@ -2196,7 +2196,7 @@ otError Mac::HandleMacCommand(Frame &aFrame) { case Frame::kMacCmdBeaconRequest: mCounters.mRxBeaconRequest++; - otLogInfoMac(GetInstance(), "Received Beacon Request"); + otLogInfoMac("Received Beacon Request"); if (mEnabled && (mBeaconsEnabled #if OPENTHREAD_CONFIG_ENABLE_BEACON_RSP_WHEN_JOINABLE @@ -2354,24 +2354,24 @@ void Mac::LogFrameRxFailure(const Frame *aFrame, otError aError) const { if (aFrame == NULL) { - otLogInfoMac(GetInstance(), "Frame rx failed, error:%s", otThreadErrorToString(aError)); + otLogInfoMac("Frame rx failed, error:%s", otThreadErrorToString(aError)); } else { - otLogInfoMac(GetInstance(), "Frame rx failed, error:%s, %s", otThreadErrorToString(aError), + otLogInfoMac("Frame rx failed, error:%s, %s", otThreadErrorToString(aError), aFrame->ToInfoString().AsCString()); } } void Mac::LogFrameTxFailure(const Frame &aFrame, otError aError) const { - otLogInfoMac(GetInstance(), "Frame tx failed, error:%s, retries:%d/%d, %s", otThreadErrorToString(aError), - mTransmitRetries, aFrame.GetMaxFrameRetries(), aFrame.ToInfoString().AsCString()); + otLogInfoMac("Frame tx failed, error:%s, retries:%d/%d, %s", otThreadErrorToString(aError), mTransmitRetries, + aFrame.GetMaxFrameRetries(), aFrame.ToInfoString().AsCString()); } void Mac::LogBeacon(const char *aActionText, const BeaconPayload &aBeaconPayload) const { - otLogInfoMac(GetInstance(), "%s Beacon, %s", aActionText, aBeaconPayload.ToInfoString().AsCString()); + otLogInfoMac("%s Beacon, %s", aActionText, aBeaconPayload.ToInfoString().AsCString()); } #else // #if (OPENTHREAD_CONFIG_LOG_LEVEL >= OT_LOG_LEVEL_INFO) && (OPENTHREAD_CONFIG_LOG_MAC == 1) diff --git a/src/core/meshcop/announce_begin_client.cpp b/src/core/meshcop/announce_begin_client.cpp index 1380345fe..0024faa75 100644 --- a/src/core/meshcop/announce_begin_client.cpp +++ b/src/core/meshcop/announce_begin_client.cpp @@ -104,7 +104,7 @@ otError AnnounceBeginClient::SendRequest(uint32_t aChannelMask, SuccessOrExit(error = GetNetif().GetCoap().SendMessage(*message, messageInfo)); - otLogInfoMeshCoP(GetInstance(), "sent announce begin query"); + otLogInfoMeshCoP("sent announce begin query"); exit: diff --git a/src/core/meshcop/border_agent.cpp b/src/core/meshcop/border_agent.cpp index 0a9d8922c..7ea0a8ea1 100644 --- a/src/core/meshcop/border_agent.cpp +++ b/src/core/meshcop/border_agent.cpp @@ -177,7 +177,7 @@ exit: message->Free(); } - otLogWarnMeshCoP(GetInstance(), "Failed to send CoAP message: %s", otThreadErrorToString(error)); + otLogWarnMeshCoP("Failed to send CoAP message: %s", otThreadErrorToString(error)); } } @@ -230,7 +230,7 @@ void BorderAgent::HandleCoapResponse(void * aContext, exit: if (error != OT_ERROR_NONE) { - otLogWarnMeshCoP(GetInstance(), "Commissioner request[%hu] failed: %s", forwardContext.GetMessageId(), + otLogWarnMeshCoP("Commissioner request[%hu] failed: %s", forwardContext.GetMessageId(), otThreadErrorToString(aResult)); forwardContext.ToHeader(header, CoapCodeFromError(error)); borderAgent.SendErrorMessage(header); @@ -350,12 +350,12 @@ void BorderAgent::HandleProxyTransmit(const Coap::Header &aHeader, const Message } SuccessOrExit(error = GetInstance().GetIp6().GetUdp().SendDatagram(*message, messageInfo, Ip6::kProtoUdp)); - otLogInfoMeshCoP(GetInstance(), "Proxy transmit sent"); + otLogInfoMeshCoP("Proxy transmit sent"); exit: if (error != OT_ERROR_NONE) { - otLogWarnMeshCoP(GetInstance(), "Failed to send proxy stream: %s", otThreadErrorToString(error)); + otLogWarnMeshCoP("Failed to send proxy stream: %s", otThreadErrorToString(error)); if (message != NULL) { @@ -408,12 +408,12 @@ bool BorderAgent::HandleProxyReceive(const Message &aMessage, const Ip6::Message SuccessOrExit(error = netif.GetCoapSecure().SendMessage(*message, netif.GetCoapSecure().GetPeerMessageInfo())); - otLogInfoMeshCoP(GetInstance(), "Sent to commissioner on %s", OT_URI_PATH_PROXY_RX); + otLogInfoMeshCoP("Sent to commissioner on %s", OT_URI_PATH_PROXY_RX); exit: if (message != NULL && error != OT_ERROR_NONE) { - otLogWarnMeshCoP(GetInstance(), "Failed notify commissioner on %s", OT_URI_PATH_PROXY_RX); + otLogWarnMeshCoP("Failed notify commissioner on %s", OT_URI_PATH_PROXY_RX); message->Free(); } @@ -435,7 +435,7 @@ void BorderAgent::HandleRelayReceive(const Coap::Header &aHeader, const Message } SuccessOrExit(ForwardToCommissioner(header, aMessage)); - otLogInfoMeshCoP(GetInstance(), "Sent to commissioner on %s", OT_URI_PATH_RELAY_RX); + otLogInfoMeshCoP("Sent to commissioner on %s", OT_URI_PATH_RELAY_RX); exit: return; @@ -456,12 +456,12 @@ otError BorderAgent::ForwardToCommissioner(const Coap::Header &aHeader, const Me SuccessOrExit(error = netif.GetCoapSecure().SendMessage(*message, netif.GetCoapSecure().GetPeerMessageInfo())); - otLogInfoMeshCoP(GetInstance(), "Sent to commissioner"); + otLogInfoMeshCoP("Sent to commissioner"); exit: if (error != OT_ERROR_NONE) { - otLogWarnMeshCoP(GetInstance(), "Failed to send to commissioner: %s", otThreadErrorToString(error)); + otLogWarnMeshCoP("Failed to send to commissioner: %s", otThreadErrorToString(error)); if (message != NULL) { message->Free(); @@ -519,13 +519,12 @@ void BorderAgent::HandleRelayTransmit(const Coap::Header &aHeader, const Message SuccessOrExit(error = netif.GetCoap().SendMessage(*message, messageInfo)); - otLogInfoMeshCoP(borderAgent->GetInstance(), "Sent to joiner router request on %s", OT_URI_PATH_RELAY_TX); + otLogInfoMeshCoP("Sent to joiner router request on %s", OT_URI_PATH_RELAY_TX); exit: if (error != OT_ERROR_NONE) { - otLogWarnMeshCoP(borderAgent->GetInstance(), - "Failed to sent to joiner router request " OT_URI_PATH_RELAY_TX " %s", + otLogWarnMeshCoP("Failed to sent to joiner router request " OT_URI_PATH_RELAY_TX " %s", otThreadErrorToString(error)); if (message != NULL) { @@ -585,12 +584,12 @@ otError BorderAgent::ForwardToLeader(const Coap::Header & aHeader, // HandleCoapResponse is responsible to free this forward context. forwardContext = NULL; - otLogInfoMeshCoP(GetInstance(), "Forwarded request to leader on %s", aPath); + otLogInfoMeshCoP("Forwarded request to leader on %s", aPath); exit: if (error != OT_ERROR_NONE) { - otLogWarnMeshCoP(GetInstance(), "Failed to forward to leader: %s", otThreadErrorToString(error)); + otLogWarnMeshCoP("Failed to forward to leader: %s", otThreadErrorToString(error)); if (forwardContext != NULL) { @@ -624,7 +623,7 @@ void BorderAgent::HandleConnected(bool aConnected) { if (aConnected) { - otLogInfoMeshCoP(GetInstance(), "Commissioner connected"); + otLogInfoMeshCoP("Commissioner connected"); SetState(OT_BORDER_AGENT_STATE_ACTIVE); mTimer.Start(kKeepAliveTimeout); } @@ -633,7 +632,7 @@ void BorderAgent::HandleConnected(bool aConnected) ThreadNetif & netif = GetNetif(); Coap::CoapSecure &coaps = netif.GetCoapSecure(); - otLogInfoMeshCoP(GetInstance(), "Commissioner disconnected"); + otLogInfoMeshCoP("Commissioner disconnected"); netif.GetIp6().GetUdp().RemoveReceiver(mProxyReceiver); netif.RemoveUnicastAddress(mCommissionerAloc); coaps.Stop(); @@ -700,12 +699,12 @@ void BorderAgent::HandleTimeout(void) if (coaps.IsConnected()) { error = coaps.Stop(); - otLogWarnMeshCoP(GetInstance(), "Reset commissioner session: %s", otThreadErrorToString(error)); + otLogWarnMeshCoP("Reset commissioner session: %s", otThreadErrorToString(error)); } else if (!coaps.IsConnectionActive()) { error = StartCoaps(); - otLogWarnMeshCoP(GetInstance(), "Restart border agent secure CoAP service: %s", otThreadErrorToString(error)); + otLogWarnMeshCoP("Restart border agent secure CoAP service: %s", otThreadErrorToString(error)); } else { diff --git a/src/core/meshcop/commissioner.cpp b/src/core/meshcop/commissioner.cpp index f7236f15e..19e8c887a 100644 --- a/src/core/meshcop/commissioner.cpp +++ b/src/core/meshcop/commissioner.cpp @@ -237,11 +237,11 @@ exit: { if (aEui64) { - otLogInfoMeshCoP(GetInstance(), "Added Joiner (%s, %s)", aEui64->ToString().AsCString(), aPSKd); + otLogInfoMeshCoP("Added Joiner (%s, %s)", aEui64->ToString().AsCString(), aPSKd); } else { - otLogInfoMeshCoP(GetInstance(), "Added Joiner (*, %s)", aPSKd); + otLogInfoMeshCoP("Added Joiner (*, %s)", aPSKd); } } @@ -299,11 +299,11 @@ exit: { if (aEui64) { - otLogInfoMeshCoP(GetInstance(), "Removed Joiner (%s)", aEui64->ToString().AsCString()); + otLogInfoMeshCoP("Removed Joiner (%s)", aEui64->ToString().AsCString()); } else { - otLogInfoMeshCoP(GetInstance(), "Removed Joiner (*)"); + otLogInfoMeshCoP("Removed Joiner (*)"); } } @@ -375,7 +375,7 @@ void Commissioner::HandleJoinerExpirationTimer(void) if (static_cast(now - mJoiners[i].mExpirationTime) >= 0) { - otLogDebgMeshCoP(GetInstance(), "removing joiner due to timeout or successfully joined"); + otLogDebgMeshCoP("removing joiner due to timeout or successfully joined"); RemoveJoiner(&mJoiners[i].mEui64, 0); // remove immediately } } @@ -450,7 +450,7 @@ otError Commissioner::SendMgmtCommissionerGetRequest(const uint8_t *aTlvs, uint8 SuccessOrExit(error = netif.GetCoap().SendMessage(*message, messageInfo, Commissioner::HandleMgmtCommissionerGetResponse, this)); - otLogInfoMeshCoP(GetInstance(), "sent MGMT_COMMISSIONER_GET.req to leader"); + otLogInfoMeshCoP("sent MGMT_COMMISSIONER_GET.req to leader"); exit: @@ -482,7 +482,7 @@ void Commissioner::HandleMgmtCommissisonerGetResponse(Coap::Header * aH OT_UNUSED_VARIABLE(aMessageInfo); VerifyOrExit(aResult == OT_ERROR_NONE && aHeader->GetCode() == OT_COAP_CODE_CHANGED); - otLogInfoMeshCoP(GetInstance(), "received MGMT_COMMISSIONER_GET response"); + otLogInfoMeshCoP("received MGMT_COMMISSIONER_GET response"); exit: return; @@ -555,7 +555,7 @@ otError Commissioner::SendMgmtCommissionerSetRequest(const otCommissioningDatase SuccessOrExit(error = netif.GetCoap().SendMessage(*message, messageInfo, Commissioner::HandleMgmtCommissionerSetResponse, this)); - otLogInfoMeshCoP(GetInstance(), "sent MGMT_COMMISSIONER_SET.req to leader"); + otLogInfoMeshCoP("sent MGMT_COMMISSIONER_SET.req to leader"); exit: @@ -587,7 +587,7 @@ void Commissioner::HandleMgmtCommissisonerSetResponse(Coap::Header * aH OT_UNUSED_VARIABLE(aMessageInfo); VerifyOrExit(aResult == OT_ERROR_NONE && aHeader->GetCode() == OT_COAP_CODE_CHANGED); - otLogInfoMeshCoP(GetInstance(), "received MGMT_COMMISSIONER_SET response"); + otLogInfoMeshCoP("received MGMT_COMMISSIONER_SET response"); exit: return; @@ -622,7 +622,7 @@ otError Commissioner::SendPetition(void) SuccessOrExit( error = netif.GetCoap().SendMessage(*message, messageInfo, Commissioner::HandleLeaderPetitionResponse, this)); - otLogInfoMeshCoP(GetInstance(), "sent petition"); + otLogInfoMeshCoP("sent petition"); exit: @@ -660,7 +660,7 @@ void Commissioner::HandleLeaderPetitionResponse(Coap::Header * aHeader, VerifyOrExit(mState == OT_COMMISSIONER_STATE_PETITION, mState = OT_COMMISSIONER_STATE_DISABLED); VerifyOrExit(aResult == OT_ERROR_NONE && aHeader->GetCode() == OT_COAP_CODE_CHANGED, retransmit = true); - otLogInfoMeshCoP(GetInstance(), "received Leader Petition response"); + otLogInfoMeshCoP("received Leader Petition response"); SuccessOrExit(Tlv::GetTlv(*aMessage, Tlv::kState, sizeof(state), state)); VerifyOrExit(state.IsValid()); @@ -728,7 +728,7 @@ otError Commissioner::SendKeepAlive(void) SuccessOrExit( error = netif.GetCoap().SendMessage(*message, messageInfo, Commissioner::HandleLeaderKeepAliveResponse, this)); - otLogInfoMeshCoP(GetInstance(), "sent keep alive"); + otLogInfoMeshCoP("sent keep alive"); exit: @@ -764,7 +764,7 @@ void Commissioner::HandleLeaderKeepAliveResponse(Coap::Header * aHeader VerifyOrExit(aResult == OT_ERROR_NONE && aHeader->GetCode() == OT_COAP_CODE_CHANGED, mState = OT_COMMISSIONER_STATE_DISABLED); - otLogInfoMeshCoP(GetInstance(), "received Leader keep-alive response"); + otLogInfoMeshCoP("received Leader keep-alive response"); SuccessOrExit(Tlv::GetTlv(*aMessage, Tlv::kState, sizeof(state), state)); VerifyOrExit(state.IsValid()); @@ -840,7 +840,7 @@ void Commissioner::HandleRelayReceive(Coap::Header &aHeader, Message &aMessage, error = netif.GetCoapSecure().SetPsk(reinterpret_cast(mJoiners[i].mPsk), static_cast(strlen(mJoiners[i].mPsk))); SuccessOrExit(error); - otLogInfoMeshCoP(GetInstance(), "found joiner, starting new session"); + otLogInfoMeshCoP("found joiner, starting new session"); enableJoiner = true; break; } @@ -858,9 +858,9 @@ void Commissioner::HandleRelayReceive(Coap::Header &aHeader, Message &aMessage, mJoinerPort = joinerPort.GetUdpPort(); mJoinerRloc = joinerRloc.GetJoinerRouterLocator(); - otLogInfoMeshCoP(GetInstance(), "Remove Relay Receive (%02x%02x%02x%02x%02x%02x%02x%02x, 0x%04x)", mJoinerIid[0], - mJoinerIid[1], mJoinerIid[2], mJoinerIid[3], mJoinerIid[4], mJoinerIid[5], mJoinerIid[6], - mJoinerIid[7], mJoinerRloc); + otLogInfoMeshCoP("Remove Relay Receive (%02x%02x%02x%02x%02x%02x%02x%02x, 0x%04x)", mJoinerIid[0], mJoinerIid[1], + mJoinerIid[2], mJoinerIid[3], mJoinerIid[4], mJoinerIid[5], mJoinerIid[6], mJoinerIid[7], + mJoinerRloc); aMessage.SetOffset(offset); SuccessOrExit(error = aMessage.SetLength(offset + length)); @@ -891,12 +891,12 @@ void Commissioner::HandleDatasetChanged(Coap::Header &aHeader, Message &aMessage { VerifyOrExit(aHeader.GetType() == OT_COAP_TYPE_CONFIRMABLE && aHeader.GetCode() == OT_COAP_CODE_POST); - otLogInfoMeshCoP(GetInstance(), "received dataset changed"); + otLogInfoMeshCoP("received dataset changed"); OT_UNUSED_VARIABLE(aMessage); SuccessOrExit(GetNetif().GetCoap().SendEmptyAck(aHeader, aMessageInfo)); - otLogInfoMeshCoP(GetInstance(), "sent dataset changed acknowledgment"); + otLogInfoMeshCoP("sent dataset changed acknowledgment"); exit: return; @@ -918,7 +918,7 @@ void Commissioner::HandleJoinerFinalize(Coap::Header &aHeader, Message &aMessage StateTlv::State state = StateTlv::kAccept; ProvisioningUrlTlv provisioningUrl; - otLogInfoMeshCoP(GetInstance(), "received joiner finalize"); + otLogInfoMeshCoP("received joiner finalize"); if (Tlv::GetTlv(aMessage, Tlv::kProvisioningUrl, sizeof(provisioningUrl), provisioningUrl) == OT_ERROR_NONE) { @@ -934,8 +934,7 @@ void Commissioner::HandleJoinerFinalize(Coap::Header &aHeader, Message &aMessage uint8_t buf[OPENTHREAD_CONFIG_MESSAGE_BUFFER_SIZE]; VerifyOrExit(aMessage.GetLength() <= sizeof(buf)); aMessage.Read(aHeader.GetLength(), aMessage.GetLength() - aHeader.GetLength(), buf); - otDumpCertMeshCoP(GetInstance(), "[THCI] direction=recv | type=JOIN_FIN.req |", buf, - aMessage.GetLength() - aHeader.GetLength()); + otDumpCertMeshCoP("[THCI] direction=recv | type=JOIN_FIN.req |", buf, aMessage.GetLength() - aHeader.GetLength()); exit: #endif @@ -973,7 +972,7 @@ void Commissioner::SendJoinFinalizeResponse(const Coap::Header &aRequestHeader, uint8_t buf[OPENTHREAD_CONFIG_MESSAGE_BUFFER_SIZE]; VerifyOrExit(message->GetLength() <= sizeof(buf)); message->Read(responseHeader.GetLength(), message->GetLength() - responseHeader.GetLength(), buf); - otDumpCertMeshCoP(GetInstance(), "[THCI] direction=send | type=JOIN_FIN.rsp |", buf, + otDumpCertMeshCoP("[THCI] direction=send | type=JOIN_FIN.rsp |", buf, message->GetLength() - responseHeader.GetLength()); #endif @@ -983,7 +982,7 @@ void Commissioner::SendJoinFinalizeResponse(const Coap::Header &aRequestHeader, extAddr.SetLocal(!extAddr.IsLocal()); RemoveJoiner(&extAddr, kRemoveJoinerDelay); // remove after kRemoveJoinerDelay (seconds) - otLogInfoMeshCoP(GetInstance(), "sent joiner finalize response"); + otLogInfoMeshCoP("sent joiner finalize response"); exit: diff --git a/src/core/meshcop/dataset.cpp b/src/core/meshcop/dataset.cpp index 558b432ce..c987700a4 100644 --- a/src/core/meshcop/dataset.cpp +++ b/src/core/meshcop/dataset.cpp @@ -545,8 +545,8 @@ otError Dataset::ApplyConfiguration(Instance &aInstance, bool *aIsMasterKeyUpdat if (error != OT_ERROR_NONE) { - otLogWarnMeshCoP(aInstance, "DatasetManager::ApplyConfiguration() Failed to set channel to %d (%s)", - channel, otThreadErrorToString(error)); + otLogWarnMeshCoP("DatasetManager::ApplyConfiguration() Failed to set channel to %d (%s)", channel, + otThreadErrorToString(error)); ExitNow(); } diff --git a/src/core/meshcop/dataset_local.cpp b/src/core/meshcop/dataset_local.cpp index d55a4b2b8..25809d4be 100644 --- a/src/core/meshcop/dataset_local.cpp +++ b/src/core/meshcop/dataset_local.cpp @@ -169,12 +169,12 @@ otError DatasetLocal::Set(const Dataset &aDataset) if (aDataset.GetSize() == 0) { error = GetInstance().GetSettings().DeleteOperationalDataset(IsActive()); - otLogInfoMeshCoP(GetInstance(), "%s dataset deleted", mType == Tlv::kActiveTimestamp ? "Active" : "Pending"); + otLogInfoMeshCoP("%s dataset deleted", mType == Tlv::kActiveTimestamp ? "Active" : "Pending"); } else { error = GetInstance().GetSettings().SaveOperationalDataset(IsActive(), aDataset); - otLogInfoMeshCoP(GetInstance(), "%s dataset set", mType == Tlv::kActiveTimestamp ? "Active" : "Pending"); + otLogInfoMeshCoP("%s dataset set", mType == Tlv::kActiveTimestamp ? "Active" : "Pending"); } SuccessOrExit(error); diff --git a/src/core/meshcop/dataset_manager.cpp b/src/core/meshcop/dataset_manager.cpp index b864e8312..9a08ea640 100644 --- a/src/core/meshcop/dataset_manager.cpp +++ b/src/core/meshcop/dataset_manager.cpp @@ -241,7 +241,7 @@ otError DatasetManager::Register(void) messageInfo.SetPeerPort(kCoapUdpPort); SuccessOrExit(error = netif.GetCoap().SendMessage(*message, messageInfo)); - otLogInfoMeshCoP(GetInstance(), "sent dataset to leader"); + otLogInfoMeshCoP("sent dataset to leader"); exit: @@ -359,7 +359,7 @@ void DatasetManager::SendGetResponse(const Coap::Header & aRequestHeader, SuccessOrExit(error = netif.GetCoap().SendMessage(*message, aMessageInfo)); - otLogInfoMeshCoP(GetInstance(), "sent dataset get response"); + otLogInfoMeshCoP("sent dataset get response"); exit: @@ -490,7 +490,7 @@ void PendingDataset::StartDelayTimer(void) } mDelayTimer.StartAt(dataset.GetUpdateTime(), delay); - otLogInfoMeshCoP(GetInstance(), "delay timer started %d", delay); + otLogInfoMeshCoP("delay timer started %d", delay); } } @@ -520,7 +520,7 @@ void PendingDataset::HandleDelayTimer(void) } } - otLogInfoMeshCoP(GetInstance(), "pending delay timer expired"); + otLogInfoMeshCoP("pending delay timer expired"); dataset.ConvertToActive(); GetNetif().GetActiveDataset().Set(dataset); diff --git a/src/core/meshcop/dataset_manager_ftd.cpp b/src/core/meshcop/dataset_manager_ftd.cpp index a117d093c..75a4f882b 100644 --- a/src/core/meshcop/dataset_manager_ftd.cpp +++ b/src/core/meshcop/dataset_manager_ftd.cpp @@ -459,7 +459,7 @@ otError DatasetManager::SendSetRequest(const otOperationalDataset &aDataset, con messageInfo.SetPeerPort(kCoapUdpPort); SuccessOrExit(error = netif.GetCoap().SendMessage(*message, messageInfo)); - otLogInfoMeshCoP(GetInstance(), "sent dataset set request to leader"); + otLogInfoMeshCoP("sent dataset set request to leader"); exit: @@ -588,7 +588,7 @@ otError DatasetManager::SendGetRequest(const otOperationalDatasetComponents &aDa messageInfo.SetPeerPort(kCoapUdpPort); SuccessOrExit(error = netif.GetCoap().SendMessage(*message, messageInfo)); - otLogInfoMeshCoP(GetInstance(), "sent dataset get request"); + otLogInfoMeshCoP("sent dataset get request"); exit: @@ -621,7 +621,7 @@ void DatasetManager::SendSetResponse(const Coap::Header & aRequestHeader, SuccessOrExit(error = netif.GetCoap().SendMessage(*message, aMessageInfo)); - otLogInfoMeshCoP(GetInstance(), "sent dataset set response"); + otLogInfoMeshCoP("sent dataset set response"); exit: @@ -742,7 +742,7 @@ otError ActiveDataset::GenerateLocal(void) SuccessOrExit(error = mLocal.Set(dataset)); Restore(); - otLogInfoMeshCoP(GetInstance(), "Generated local dataset"); + otLogInfoMeshCoP("Generated local dataset"); exit: return error; diff --git a/src/core/meshcop/dtls.cpp b/src/core/meshcop/dtls.cpp index ade6945fd..1f6d9d3cf 100644 --- a/src/core/meshcop/dtls.cpp +++ b/src/core/meshcop/dtls.cpp @@ -228,12 +228,12 @@ otError Dtls::Start(bool aClient, if (mCipherSuites[0] == MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8) { - otLogInfoMeshCoP(GetInstance(), "DTLS started"); + otLogInfoMeshCoP("DTLS started"); } #if OPENTHREAD_ENABLE_APPLICATION_COAP_SECURE else { - otLogInfoCoap(GetInstance(), "Application Coap Secure DTLS started"); + otLogInfoCoap("Application Coap Secure DTLS started"); } #endif // OPENTHREAD_ENABLE_APPLICATION_COAP_SECURE @@ -281,7 +281,7 @@ int Dtls::SetApplicationCoapSecureKeys(void) break; default: - otLogCritCoap(GetInstance(), "Application Coap Secure DTLS: Not supported cipher."); + otLogCritCoap("Application Coap Secure DTLS: Not supported cipher."); rval = MBEDTLS_ERR_SSL_BAD_INPUT_DATA; ExitNow(); break; @@ -506,12 +506,12 @@ int Dtls::HandleMbedtlsTransmit(const unsigned char *aBuf, size_t aLength) if (mCipherSuites[0] == MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8) { - otLogInfoMeshCoP(GetInstance(), "Dtls::HandleMbedtlsTransmit"); + otLogInfoMeshCoP("Dtls::HandleMbedtlsTransmit"); } #if OPENTHREAD_ENABLE_APPLICATION_COAP_SECURE else { - otLogInfoCoap(GetInstance(), "Dtls::ApplicationCoapSecure HandleMbedtlsTransmit"); + otLogInfoCoap("Dtls::ApplicationCoapSecure HandleMbedtlsTransmit"); } #endif // OPENTHREAD_ENABLE_APPLICATION_COAP_SECURE @@ -549,12 +549,12 @@ int Dtls::HandleMbedtlsReceive(unsigned char *aBuf, size_t aLength) if (mCipherSuites[0] == MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8) { - otLogInfoMeshCoP(GetInstance(), "Dtls::HandleMbedtlsReceive"); + otLogInfoMeshCoP("Dtls::HandleMbedtlsReceive"); } #if OPENTHREAD_ENABLE_APPLICATION_COAP_SECURE else { - otLogInfoCoap(GetInstance(), "Dtls:: ApplicationCoapSecure HandleMbedtlsReceive"); + otLogInfoCoap("Dtls:: ApplicationCoapSecure HandleMbedtlsReceive"); } #endif // OPENTHREAD_ENABLE_APPLICATION_COAP_SECURE @@ -584,12 +584,12 @@ int Dtls::HandleMbedtlsGetTimer(void) if (mCipherSuites[0] == MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8) { - otLogInfoMeshCoP(GetInstance(), "Dtls::HandleMbedtlsGetTimer"); + otLogInfoMeshCoP("Dtls::HandleMbedtlsGetTimer"); } #if OPENTHREAD_ENABLE_APPLICATION_COAP_SECURE else { - otLogInfoCoap(GetInstance(), "Dtls:: ApplicationCoapSecure HandleMbedtlsGetTimer"); + otLogInfoCoap("Dtls:: ApplicationCoapSecure HandleMbedtlsGetTimer"); } #endif // OPENTHREAD_ENABLE_APPLICATION_COAP_SECURE @@ -622,12 +622,12 @@ void Dtls::HandleMbedtlsSetTimer(uint32_t aIntermediate, uint32_t aFinish) { if (mCipherSuites[0] == MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8) { - otLogInfoMeshCoP(GetInstance(), "Dtls::SetTimer"); + otLogInfoMeshCoP("Dtls::SetTimer"); } #if OPENTHREAD_ENABLE_APPLICATION_COAP_SECURE else { - otLogInfoCoap(GetInstance(), "Dtls::ApplicationCoapSecure SetTimer"); + otLogInfoCoap("Dtls::ApplicationCoapSecure SetTimer"); } #endif // OPENTHREAD_ENABLE_APPLICATION_COAP_SECURE @@ -672,12 +672,12 @@ int Dtls::HandleMbedtlsExportKeys(const unsigned char *aMasterSecret, if (mCipherSuites[0] == MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8) { - otLogInfoMeshCoP(GetInstance(), "Generated KEK"); + otLogInfoMeshCoP("Generated KEK"); } #if OPENTHREAD_ENABLE_APPLICATION_COAP_SECURE else { - otLogInfoCoap(GetInstance(), "ApplicationCoapSecure Generated KEK"); + otLogInfoCoap("ApplicationCoapSecure Generated KEK"); } #endif // OPENTHREAD_ENABLE_APPLICATION_COAP_SECURE @@ -876,20 +876,20 @@ void Dtls::HandleMbedtlsDebug(void *ctx, int level, const char *, int, const cha switch (level) { case 1: - otLogCritMbedTls(pThis->GetInstance(), "%s", str); + otLogCritMbedTls("%s", str); break; case 2: - otLogWarnMbedTls(pThis->GetInstance(), "%s", str); + otLogWarnMbedTls("%s", str); break; case 3: - otLogInfoMbedTls(pThis->GetInstance(), "%s", str); + otLogInfoMbedTls("%s", str); break; case 4: default: - otLogDebgMbedTls(pThis->GetInstance(), "%s", str); + otLogDebgMbedTls("%s", str); break; } } @@ -899,17 +899,17 @@ void Dtls::HandleMbedtlsDebug(void *ctx, int level, const char *, int, const cha switch (level) { case 1: - otLogCritCoap(pThis->GetInstance(), "ApplicationCoapSecure Mbedtls: %s", str); + otLogCritCoap("ApplicationCoapSecure Mbedtls: %s", str); break; case 2: - otLogWarnCoap(pThis->GetInstance(), "ApplicationCoapSecure Mbedtls: %s", str); + otLogWarnCoap("ApplicationCoapSecure Mbedtls: %s", str); break; case 3: - otLogInfoCoap(pThis->GetInstance(), "ApplicationCoapSecure Mbedtls: %s", str); + otLogInfoCoap("ApplicationCoapSecure Mbedtls: %s", str); break; case 4: default: - otLogDebgCoap(pThis->GetInstance(), "ApplicationCoapSecure Mbedtls: %s", str); + otLogDebgCoap("ApplicationCoapSecure Mbedtls: %s", str); break; } } diff --git a/src/core/meshcop/energy_scan_client.cpp b/src/core/meshcop/energy_scan_client.cpp index 7be32b1c5..0df0d7b65 100644 --- a/src/core/meshcop/energy_scan_client.cpp +++ b/src/core/meshcop/energy_scan_client.cpp @@ -118,7 +118,7 @@ otError EnergyScanClient::SendQuery(uint32_t aChannelM messageInfo.SetInterfaceId(netif.GetInterfaceId()); SuccessOrExit(error = netif.GetCoap().SendMessage(*message, messageInfo)); - otLogInfoMeshCoP(GetInstance(), "sent energy scan query"); + otLogInfoMeshCoP("sent energy scan query"); mCallback = aCallback; mContext = aContext; @@ -158,7 +158,7 @@ void EnergyScanClient::HandleReport(Coap::Header &aHeader, Message &aMessage, co VerifyOrExit(aHeader.GetType() == OT_COAP_TYPE_CONFIRMABLE && aHeader.GetCode() == OT_COAP_CODE_POST); - otLogInfoMeshCoP(GetInstance(), "received energy scan report"); + otLogInfoMeshCoP("received energy scan report"); SuccessOrExit(MeshCoP::Tlv::GetTlv(aMessage, MeshCoP::Tlv::kChannelMask, sizeof(channelMask), channelMask)); VerifyOrExit(channelMask.IsValid()); @@ -173,7 +173,7 @@ void EnergyScanClient::HandleReport(Coap::Header &aHeader, Message &aMessage, co SuccessOrExit(netif.GetCoap().SendEmptyAck(aHeader, responseInfo)); - otLogInfoMeshCoP(GetInstance(), "sent energy scan report response"); + otLogInfoMeshCoP("sent energy scan report response"); exit: return; diff --git a/src/core/meshcop/joiner.cpp b/src/core/meshcop/joiner.cpp index 82206c4ac..edabdf4d9 100644 --- a/src/core/meshcop/joiner.cpp +++ b/src/core/meshcop/joiner.cpp @@ -196,13 +196,13 @@ void Joiner::HandleDiscoverResult(otActiveScanResult *aResult) { JoinerRouter joinerRouter; - otLogDebgMeshCoP(GetInstance(), "Received Discovery Response (%s)", + otLogDebgMeshCoP("Received Discovery Response (%s)", static_cast(aResult->mExtAddress).ToString().AsCString()); // Joining is disabled if the Steering Data is not included if (aResult->mSteeringData.mLength == 0) { - otLogDebgMeshCoP(GetInstance(), "No steering data, joining disabled"); + otLogDebgMeshCoP("No steering data, joining disabled"); ExitNow(); } @@ -213,7 +213,7 @@ void Joiner::HandleDiscoverResult(otActiveScanResult *aResult) if (!steeringData.GetBit(mCcitt % steeringData.GetNumBits()) || !steeringData.GetBit(mAnsi % steeringData.GetNumBits())) { - otLogDebgMeshCoP(GetInstance(), "Steering data does not include this device"); + otLogDebgMeshCoP("Steering data does not include this device"); ExitNow(); } @@ -303,7 +303,7 @@ otError Joiner::TryNextJoin() } else { - otLogDebgMeshCoP(GetInstance(), "No joinable networks remaining to try"); + otLogDebgMeshCoP("No joinable networks remaining to try"); } return error; @@ -396,13 +396,12 @@ void Joiner::SendJoinerFinalize(void) uint8_t buf[OPENTHREAD_CONFIG_MESSAGE_BUFFER_SIZE]; VerifyOrExit(message->GetLength() <= sizeof(buf)); message->Read(header.GetLength(), message->GetLength() - header.GetLength(), buf); - otDumpCertMeshCoP(GetInstance(), "[THCI] direction=send | type=JOIN_FIN.req |", buf, - message->GetLength() - header.GetLength()); + otDumpCertMeshCoP("[THCI] direction=send | type=JOIN_FIN.req |", buf, message->GetLength() - header.GetLength()); #endif SuccessOrExit(error = netif.GetCoapSecure().SendMessage(*message, Joiner::HandleJoinerFinalizeResponse, this)); - otLogInfoMeshCoP(GetInstance(), "Sent joiner finalize"); + otLogInfoMeshCoP("Sent joiner finalize"); exit: @@ -440,13 +439,12 @@ void Joiner::HandleJoinerFinalizeResponse(Coap::Header * aHeader, mState = OT_JOINER_STATE_ENTRUST; mTimer.Start(kTimeout); - otLogInfoMeshCoP(GetInstance(), "received joiner finalize response %d", static_cast(state.GetState())); + otLogInfoMeshCoP("received joiner finalize response %d", static_cast(state.GetState())); #if OPENTHREAD_ENABLE_CERT_LOG uint8_t buf[OPENTHREAD_CONFIG_MESSAGE_BUFFER_SIZE]; VerifyOrExit(aMessage->GetLength() <= sizeof(buf)); aMessage->Read(aHeader->GetLength(), aMessage->GetLength() - aHeader->GetLength(), buf); - otDumpCertMeshCoP(GetInstance(), "[THCI] direction=recv | type=JOIN_FIN.rsp |", buf, - aMessage->GetLength() - aHeader->GetLength()); + otDumpCertMeshCoP("[THCI] direction=recv | type=JOIN_FIN.rsp |", buf, aMessage->GetLength() - aHeader->GetLength()); #endif exit: @@ -478,8 +476,8 @@ void Joiner::HandleJoinerEntrust(Coap::Header &aHeader, Message &aMessage, const aHeader.GetCode() == OT_COAP_CODE_POST, error = OT_ERROR_DROP); - otLogInfoMeshCoP(GetInstance(), "Received joiner entrust"); - otLogCertMeshCoP(GetInstance(), "[THCI] direction=recv | type=JOIN_ENT.ntf"); + otLogInfoMeshCoP("Received joiner entrust"); + otLogCertMeshCoP("[THCI] direction=recv | type=JOIN_ENT.ntf"); SuccessOrExit(error = Tlv::GetTlv(aMessage, Tlv::kNetworkMasterKey, sizeof(masterKey), masterKey)); VerifyOrExit(masterKey.IsValid(), error = OT_ERROR_PARSE); @@ -511,7 +509,7 @@ void Joiner::HandleJoinerEntrust(Coap::Header &aHeader, Message &aMessage, const netif.GetMac().SetNetworkName(name.m8); } - otLogInfoMeshCoP(GetInstance(), "join success!"); + otLogInfoMeshCoP("join success!"); // Send dummy response. SendJoinerEntrustResponse(aHeader, aMessageInfo); @@ -523,7 +521,7 @@ exit: if (error != OT_ERROR_NONE) { - otLogWarnMeshCoP(GetInstance(), "Error while processing joiner entrust: %s", otThreadErrorToString(error)); + otLogWarnMeshCoP("Error while processing joiner entrust: %s", otThreadErrorToString(error)); } } @@ -545,10 +543,10 @@ void Joiner::SendJoinerEntrustResponse(const Coap::Header &aRequestHeader, const mState = OT_JOINER_STATE_JOINED; - otLogInfoArp(GetInstance(), "Sent Joiner Entrust response"); + otLogInfoArp("Sent Joiner Entrust response"); - otLogInfoMeshCoP(GetInstance(), "Sent joiner entrust response length = %d", message->GetLength()); - otLogCertMeshCoP(GetInstance(), "[THCI] direction=send | type=JOIN_ENT.rsp"); + otLogInfoMeshCoP("Sent joiner entrust response length = %d", message->GetLength()); + otLogCertMeshCoP("[THCI] direction=send | type=JOIN_ENT.rsp"); exit: diff --git a/src/core/meshcop/joiner_router.cpp b/src/core/meshcop/joiner_router.cpp index 20e1b980d..a851a9dd6 100644 --- a/src/core/meshcop/joiner_router.cpp +++ b/src/core/meshcop/joiner_router.cpp @@ -93,7 +93,7 @@ void JoinerRouter::HandleStateChanged(otChangedFlags aFlags) mSocket.Open(&JoinerRouter::HandleUdpReceive, this); mSocket.Bind(sockaddr); netif.GetIp6Filter().AddUnsecurePort(sockaddr.mPort); - otLogInfoMeshCoP(GetInstance(), "Joiner Router: start"); + otLogInfoMeshCoP("Joiner Router: start"); } else { @@ -149,7 +149,7 @@ void JoinerRouter::HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &a ExtendedTlv tlv; uint16_t borderAgentRloc; - otLogInfoMeshCoP(GetInstance(), "JoinerRouter::HandleUdpReceive"); + otLogInfoMeshCoP("JoinerRouter::HandleUdpReceive"); SuccessOrExit(error = GetBorderAgentRloc(GetNetif(), borderAgentRloc)); @@ -199,7 +199,7 @@ void JoinerRouter::HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &a SuccessOrExit(error = netif.GetCoap().SendMessage(*message, messageInfo)); - otLogInfoMeshCoP(GetInstance(), "Sent relay rx"); + otLogInfoMeshCoP("Sent relay rx"); exit: @@ -233,7 +233,7 @@ void JoinerRouter::HandleRelayTransmit(Coap::Header &aHeader, Message &aMessage, VerifyOrExit(aHeader.GetType() == OT_COAP_TYPE_NON_CONFIRMABLE && aHeader.GetCode() == OT_COAP_CODE_POST, error = OT_ERROR_DROP); - otLogInfoMeshCoP(GetInstance(), "Received relay transmit"); + otLogInfoMeshCoP("Received relay transmit"); SuccessOrExit(error = Tlv::GetTlv(aMessage, Tlv::kJoinerUdpPort, sizeof(joinerPort), joinerPort)); VerifyOrExit(joinerPort.IsValid(), error = OT_ERROR_PARSE); @@ -274,7 +274,7 @@ void JoinerRouter::HandleRelayTransmit(Coap::Header &aHeader, Message &aMessage, if (Tlv::GetTlv(aMessage, Tlv::kJoinerRouterKek, sizeof(kek), kek) == OT_ERROR_NONE) { - otLogInfoMeshCoP(GetInstance(), "Received kek"); + otLogInfoMeshCoP("Received kek"); DelaySendingJoinerEntrust(messageInfo, kek); } @@ -462,12 +462,12 @@ otError JoinerRouter::SendJoinerEntrust(Message &aMessage, const Ip6::MessageInf netif.GetCoap().AbortTransaction(&JoinerRouter::HandleJoinerEntrustResponse, this); - otLogInfoMeshCoP(GetInstance(), "Sending JOIN_ENT.ntf"); + otLogInfoMeshCoP("Sending JOIN_ENT.ntf"); SuccessOrExit( error = netif.GetCoap().SendMessage(aMessage, aMessageInfo, &JoinerRouter::HandleJoinerEntrustResponse, this)); - otLogInfoMeshCoP(GetInstance(), "Sent joiner entrust length = %d", aMessage.GetLength()); - otLogCertMeshCoP(GetInstance(), "[THCI] direction=send | type=JOIN_ENT.ntf"); + otLogInfoMeshCoP("Sent joiner entrust length = %d", aMessage.GetLength()); + otLogCertMeshCoP("[THCI] direction=send | type=JOIN_ENT.ntf"); mExpectJoinEntRsp = true; @@ -500,8 +500,8 @@ void JoinerRouter::HandleJoinerEntrustResponse(Coap::Header * aHeader, VerifyOrExit(aHeader->GetCode() == OT_COAP_CODE_CHANGED); - otLogInfoMeshCoP(GetInstance(), "Receive joiner entrust response"); - otLogCertMeshCoP(GetInstance(), "[THCI] direction=recv | type=JOIN_ENT.rsp"); + otLogInfoMeshCoP("Receive joiner entrust response"); + otLogCertMeshCoP("[THCI] direction=recv | type=JOIN_ENT.rsp"); exit: return; diff --git a/src/core/meshcop/leader.cpp b/src/core/meshcop/leader.cpp index 667e6c66b..322431502 100644 --- a/src/core/meshcop/leader.cpp +++ b/src/core/meshcop/leader.cpp @@ -83,7 +83,7 @@ void Leader::HandlePetition(Coap::Header &aHeader, Message &aMessage, const Ip6: CommissionerIdTlv commissionerId; StateTlv::State state = StateTlv::kReject; - otLogInfoMeshCoP(GetInstance(), "received petition"); + otLogInfoMeshCoP("received petition"); VerifyOrExit(GetNetif().GetMle().IsRoutingLocator(aMessageInfo.GetPeerAddr())); SuccessOrExit(Tlv::GetTlv(aMessage, Tlv::kCommissionerId, sizeof(commissionerId), commissionerId)); @@ -155,7 +155,7 @@ otError Leader::SendPetitionResponse(const Coap::Header & aRequestHeader, SuccessOrExit(error = netif.GetCoap().SendMessage(*message, aMessageInfo)); - otLogInfoMeshCoP(GetInstance(), "sent petition response"); + otLogInfoMeshCoP("sent petition response"); exit: @@ -185,7 +185,7 @@ void Leader::HandleKeepAlive(Coap::Header &aHeader, Message &aMessage, const Ip6 BorderAgentLocatorTlv * borderAgentLocator; StateTlv::State responseState; - otLogInfoMeshCoP(GetInstance(), "received keep alive"); + otLogInfoMeshCoP("received keep alive"); SuccessOrExit(Tlv::GetTlv(aMessage, Tlv::kState, sizeof(state), state)); VerifyOrExit(state.IsValid()); @@ -246,7 +246,7 @@ otError Leader::SendKeepAliveResponse(const Coap::Header & aRequestHeader, SuccessOrExit(error = netif.GetCoap().SendMessage(*message, aMessageInfo)); - otLogInfoMeshCoP(GetInstance(), "sent keep alive response"); + otLogInfoMeshCoP("sent keep alive response"); exit: @@ -277,7 +277,7 @@ otError Leader::SendDatasetChanged(const Ip6::Address &aAddress) messageInfo.SetPeerPort(kCoapUdpPort); SuccessOrExit(error = netif.GetCoap().SendMessage(*message, messageInfo)); - otLogInfoMeshCoP(GetInstance(), "sent dataset changed"); + otLogInfoMeshCoP("sent dataset changed"); exit: @@ -336,7 +336,7 @@ void Leader::ResignCommissioner(void) mTimer.Stop(); SetEmptyCommissionerData(); - otLogInfoMeshCoP(GetInstance(), "commissioner inactive"); + otLogInfoMeshCoP("commissioner inactive"); } } // namespace MeshCoP diff --git a/src/core/meshcop/panid_query_client.cpp b/src/core/meshcop/panid_query_client.cpp index 2ae4867dc..4ae28feb0 100644 --- a/src/core/meshcop/panid_query_client.cpp +++ b/src/core/meshcop/panid_query_client.cpp @@ -102,7 +102,7 @@ otError PanIdQueryClient::SendQuery(uint16_t aPanId, messageInfo.SetInterfaceId(netif.GetInterfaceId()); SuccessOrExit(error = netif.GetCoap().SendMessage(*message, messageInfo)); - otLogInfoMeshCoP(GetInstance(), "sent panid query"); + otLogInfoMeshCoP("sent panid query"); mCallback = aCallback; mContext = aContext; @@ -136,7 +136,7 @@ void PanIdQueryClient::HandleConflict(Coap::Header &aHeader, Message &aMessage, VerifyOrExit(aHeader.GetType() == OT_COAP_TYPE_CONFIRMABLE && aHeader.GetCode() == OT_COAP_CODE_POST); - otLogInfoMeshCoP(GetInstance(), "received panid conflict"); + otLogInfoMeshCoP("received panid conflict"); SuccessOrExit(MeshCoP::Tlv::GetTlv(aMessage, MeshCoP::Tlv::kPanId, sizeof(panId), panId)); VerifyOrExit(panId.IsValid()); @@ -151,7 +151,7 @@ void PanIdQueryClient::HandleConflict(Coap::Header &aHeader, Message &aMessage, SuccessOrExit(netif.GetCoap().SendEmptyAck(aHeader, responseInfo)); - otLogInfoMeshCoP(GetInstance(), "sent panid query conflict response"); + otLogInfoMeshCoP("sent panid query conflict response"); exit: return; diff --git a/src/core/net/dhcp6_client.cpp b/src/core/net/dhcp6_client.cpp index 3fb97694d..8b7fcf95c 100644 --- a/src/core/net/dhcp6_client.cpp +++ b/src/core/net/dhcp6_client.cpp @@ -395,7 +395,7 @@ otError Dhcp6Client::Solicit(uint16_t aRloc16) messageInfo.mInterfaceId = netif.GetInterfaceId(); SuccessOrExit(error = mSocket.SendTo(*message, messageInfo)); - otLogInfoIp6(GetInstance(), "solicit"); + otLogInfoIp6("solicit"); exit: diff --git a/src/core/net/icmp6.cpp b/src/core/net/icmp6.cpp index 9ba95c65d..83b024ff4 100644 --- a/src/core/net/icmp6.cpp +++ b/src/core/net/icmp6.cpp @@ -98,7 +98,7 @@ otError Icmp::SendEchoRequest(Message &aMessage, const MessageInfo &aMessageInfo aMessage.SetOffset(0); SuccessOrExit(error = GetIp6().SendDatagram(aMessage, messageInfoLocal, kProtoIcmp6)); - otLogInfoIcmp(GetInstance(), "Sent echo request: (seq = %d)", icmpHeader.GetSequence()); + otLogInfoIcmp("Sent echo request: (seq = %d)", icmpHeader.GetSequence()); exit: return error; @@ -128,7 +128,7 @@ otError Icmp::SendError(IcmpHeader::Type aType, SuccessOrExit(error = GetIp6().SendDatagram(*message, messageInfoLocal, kProtoIcmp6)); - otLogInfoIcmp(GetInstance(), "Sent ICMPv6 Error"); + otLogInfoIcmp("Sent ICMPv6 Error"); exit: @@ -208,14 +208,14 @@ otError Icmp::HandleEchoRequest(Message &aRequestMessage, const MessageInfo &aMe VerifyOrExit(ShouldHandleEchoRequest(aMessageInfo) || aMessageInfo.GetSockAddr().IsRoutingLocator() || aMessageInfo.GetSockAddr().IsAnycastRoutingLocator()); - otLogInfoIcmp(GetInstance(), "Received Echo Request"); + otLogInfoIcmp("Received Echo Request"); icmp6Header.Init(); icmp6Header.SetType(IcmpHeader::kTypeEchoReply); if ((replyMessage = GetIp6().NewMessage(0)) == NULL) { - otLogDebgIcmp(GetInstance(), "Failed to allocate a new message"); + otLogDebgIcmp("Failed to allocate a new message"); ExitNow(); } @@ -238,7 +238,7 @@ otError Icmp::HandleEchoRequest(Message &aRequestMessage, const MessageInfo &aMe SuccessOrExit(error = GetIp6().SendDatagram(*replyMessage, replyMessageInfo, kProtoIcmp6)); replyMessage->Read(replyMessage->GetOffset(), sizeof(icmp6Header), &icmp6Header); - otLogInfoIcmp(GetInstance(), "Sent Echo Reply (seq = %d)", icmp6Header.GetSequence()); + otLogInfoIcmp("Sent Echo Reply (seq = %d)", icmp6Header.GetSequence()); exit: diff --git a/src/core/net/ip6.cpp b/src/core/net/ip6.cpp index ee465e416..55bee5f1a 100644 --- a/src/core/net/ip6.cpp +++ b/src/core/net/ip6.cpp @@ -217,12 +217,11 @@ otError Ip6::InsertMplOption(Message &aMessage, Header &aIp6Header, MessageInfo if ((messageCopy = aMessage.Clone()) != NULL) { HandleDatagram(*messageCopy, NULL, aMessageInfo.GetInterfaceId(), NULL, true); - otLogInfoIp6(GetInstance(), "Message copy for indirect transmission to sleepy children"); + otLogInfoIp6("Message copy for indirect transmission to sleepy children"); } else { - otLogWarnIp6(GetInstance(), - "No enough buffer for message copy for indirect transmission to sleepy children"); + otLogWarnIp6("No enough buffer for message copy for indirect transmission to sleepy children"); } } @@ -412,14 +411,13 @@ otError Ip6::SendDatagram(Message &aMessage, MessageInfo &aMessageInfo, IpProto if ((messageCopy = aMessage.Clone()) != NULL) { - otLogInfoIp6(GetInstance(), "Message copy for indirect transmission to sleepy children"); + otLogInfoIp6("Message copy for indirect transmission to sleepy children"); messageCopy->SetInterfaceId(aMessageInfo.GetInterfaceId()); EnqueueDatagram(*messageCopy); } else { - otLogWarnIp6(GetInstance(), - "No enough buffer for message copy for indirect transmission to sleepy children"); + otLogWarnIp6("No enough buffer for message copy for indirect transmission to sleepy children"); } } @@ -684,13 +682,11 @@ exit: switch (error) { case OT_ERROR_NO_BUFS: - otLogWarnIp6(GetInstance(), "Failed to pass up message (len: %d) to host - out of message buffer.", - aMessage.GetLength()); + otLogWarnIp6("Failed to pass up message (len: %d) to host - out of message buffer.", aMessage.GetLength()); break; case OT_ERROR_DROP: - otLogNoteIp6(GetInstance(), "Dropping message (len: %d) from local host since next hop is the host.", - aMessage.GetLength()); + otLogNoteIp6("Dropping message (len: %d) from local host since next hop is the host.", aMessage.GetLength()); break; default: diff --git a/src/core/thread/address_resolver.cpp b/src/core/thread/address_resolver.cpp index 11724dfd3..71c6e08cd 100644 --- a/src/core/thread/address_resolver.cpp +++ b/src/core/thread/address_resolver.cpp @@ -196,12 +196,12 @@ void AddressResolver::InvalidateCacheEntry(Cache &aEntry, InvalidationReason aRe switch (aEntry.mState) { case Cache::kStateCached: - otLogNoteArp(GetInstance(), "Cache entry removed: %s, 0x%04x - %s", aEntry.mTarget.ToString().AsCString(), - aEntry.mRloc16, ConvertInvalidationReasonToString(aReason)); + otLogNoteArp("Cache entry removed: %s, 0x%04x - %s", aEntry.mTarget.ToString().AsCString(), aEntry.mRloc16, + ConvertInvalidationReasonToString(aReason)); break; case Cache::kStateQuery: - otLogNoteArp(GetInstance(), "Cache entry (query mode) removed: %s, timeout:%d, retry:%d - %s", + otLogNoteArp("Cache entry (query mode) removed: %s, timeout:%d, retry:%d - %s", aEntry.mTarget.ToString().AsCString(), aEntry.mTimeout, aEntry.mRetryTimeout, ConvertInvalidationReasonToString(aReason)); break; @@ -241,8 +241,7 @@ void AddressResolver::UpdateCacheEntry(const Ip6::Address &aEid, Mac::ShortAddre GetNetif().GetMeshForwarder().HandleResolved(aEid, OT_ERROR_NONE); } - otLogNoteArp(GetInstance(), "Cache entry updated (snoop): %s, 0x%04x", aEid.ToString().AsCString(), - aRloc16); + otLogNoteArp("Cache entry updated (snoop): %s, 0x%04x", aEid.ToString().AsCString(), aRloc16); } ExitNow(); @@ -344,7 +343,7 @@ otError AddressResolver::SendAddressQuery(const Ip6::Address &aEid) SuccessOrExit(error = netif.GetCoap().SendMessage(*message, messageInfo)); - otLogInfoArp(GetInstance(), "Sending address query for %s", aEid.ToString().AsCString()); + otLogInfoArp("Sending address query for %s", aEid.ToString().AsCString()); exit: @@ -402,7 +401,7 @@ void AddressResolver::HandleAddressNotification(Coap::Header & aHeader, lastTransactionTime = lastTransactionTimeTlv.GetTime(); } - otLogInfoArp(GetInstance(), "Received address notification from 0x%04x for %s to 0x%04x", + otLogInfoArp("Received address notification from 0x%04x for %s to 0x%04x", HostSwap16(aMessageInfo.GetPeerAddr().mFields.m16[7]), targetTlv.GetTarget().ToString().AsCString(), rloc16Tlv.GetRloc16()); @@ -445,12 +444,12 @@ void AddressResolver::HandleAddressNotification(Coap::Header & aHeader, mCache[i].mState = Cache::kStateCached; MarkCacheEntryAsUsed(mCache[i]); - otLogNoteArp(GetInstance(), "Cache entry updated (notification): %s, 0x%04x, lastTrans:%d", + otLogNoteArp("Cache entry updated (notification): %s, 0x%04x, lastTrans:%d", targetTlv.GetTarget().ToString().AsCString(), rloc16Tlv.GetRloc16(), lastTransactionTime); if (netif.GetCoap().SendEmptyAck(aHeader, aMessageInfo) == OT_ERROR_NONE) { - otLogInfoArp(GetInstance(), "Sending address notification acknowledgment"); + otLogInfoArp("Sending address notification acknowledgment"); } netif.GetMeshForwarder().HandleResolved(targetTlv.GetTarget(), OT_ERROR_NONE); @@ -497,7 +496,7 @@ otError AddressResolver::SendAddressError(const ThreadTargetTlv & aTarget, SuccessOrExit(error = netif.GetCoap().SendMessage(*message, messageInfo)); - otLogInfoArp(GetInstance(), "Sending address error for target %s", aTarget.GetTarget().ToString().AsCString()); + otLogInfoArp("Sending address error for target %s", aTarget.GetTarget().ToString().AsCString()); exit: @@ -531,13 +530,13 @@ void AddressResolver::HandleAddressError(Coap::Header &aHeader, Message &aMessag VerifyOrExit(aHeader.GetType() == OT_COAP_TYPE_CONFIRMABLE && aHeader.GetCode() == OT_COAP_CODE_POST, error = OT_ERROR_DROP); - otLogInfoArp(GetInstance(), "Received address error notification"); + otLogInfoArp("Received address error notification"); if (aHeader.IsConfirmable() && !aMessageInfo.GetSockAddr().IsMulticast()) { if (netif.GetCoap().SendEmptyAck(aHeader, aMessageInfo) == OT_ERROR_NONE) { - otLogInfoArp(GetInstance(), "Sent address error notification acknowledgment"); + otLogInfoArp("Sent address error notification acknowledgment"); } } @@ -591,8 +590,7 @@ exit: if (error != OT_ERROR_NONE) { - otLogWarnArp(GetInstance(), "Error while processing address error notification: %s", - otThreadErrorToString(error)); + otLogWarnArp("Error while processing address error notification: %s", otThreadErrorToString(error)); } return; @@ -624,7 +622,7 @@ void AddressResolver::HandleAddressQuery(Coap::Header &aHeader, Message &aMessag lastTransactionTimeTlv.Init(); - otLogInfoArp(GetInstance(), "Received address query from 0x%04x for target %s", + otLogInfoArp("Received address query from 0x%04x for target %s", HostSwap16(aMessageInfo.GetPeerAddr().mFields.m16[7]), targetTlv.GetTarget().ToString().AsCString()); if (netif.IsUnicastAddress(targetTlv.GetTarget())) @@ -692,8 +690,7 @@ void AddressResolver::SendAddressQueryResponse(const ThreadTargetTlv & SuccessOrExit(error = netif.GetCoap().SendMessage(*message, messageInfo)); - otLogInfoArp(GetInstance(), "Sending address notification for target %s", - aTargetTlv.GetTarget().ToString().AsCString()); + otLogInfoArp("Sending address notification for target %s", aTargetTlv.GetTarget().ToString().AsCString()); exit: @@ -739,7 +736,7 @@ void AddressResolver::HandleTimer(void) mCache[i].mRetryTimeout = kAddressQueryMaxRetryDelay; } - otLogInfoArp(GetInstance(), "Timed out waiting for address notification for %s, retry: %d", + otLogInfoArp("Timed out waiting for address notification for %s, retry: %d", mCache[i].mTarget.ToString().AsCString(), mCache[i].mRetryTimeout); GetNetif().GetMeshForwarder().HandleResolved(mCache[i].mTarget, OT_ERROR_DROP); diff --git a/src/core/thread/announce_begin_server.cpp b/src/core/thread/announce_begin_server.cpp index 9a94f9674..86fde9da4 100644 --- a/src/core/thread/announce_begin_server.cpp +++ b/src/core/thread/announce_begin_server.cpp @@ -101,7 +101,7 @@ void AnnounceBeginServer::HandleRequest(Coap::Header &aHeader, Message &aMessage if (aHeader.IsConfirmable() && !aMessageInfo.GetSockAddr().IsMulticast()) { SuccessOrExit(GetNetif().GetCoap().SendEmptyAck(aHeader, responseInfo)); - otLogInfoMeshCoP(GetInstance(), "sent announce begin response"); + otLogInfoMeshCoP("sent announce begin response"); } exit: diff --git a/src/core/thread/announce_sender.cpp b/src/core/thread/announce_sender.cpp index ba13dd6dd..e26ec5da4 100644 --- a/src/core/thread/announce_sender.cpp +++ b/src/core/thread/announce_sender.cpp @@ -183,7 +183,7 @@ void AnnounceSender::CheckState(void) SendAnnounce(channelMask, 0, period, kMaxJitter); - otLogInfoMle(GetInstance(), "Starting periodic MLE Announcements tx, period %u, mask %s", period, + otLogInfoMle("Starting periodic MLE Announcements tx, period %u, mask %s", period, channelMask.ToString().AsCString()); exit: @@ -193,7 +193,7 @@ exit: void AnnounceSender::Stop(void) { AnnounceSenderBase::Stop(); - otLogInfoMle(GetInstance(), "Stopping periodic MLE Announcements tx"); + otLogInfoMle("Stopping periodic MLE Announcements tx"); } void AnnounceSender::HandleStateChanged(Notifier::Callback &aCallback, otChangedFlags aFlags) diff --git a/src/core/thread/data_poll_manager.cpp b/src/core/thread/data_poll_manager.cpp index 892ee442a..a8946f751 100644 --- a/src/core/thread/data_poll_manager.cpp +++ b/src/core/thread/data_poll_manager.cpp @@ -127,7 +127,7 @@ exit: switch (error) { case OT_ERROR_NONE: - otLogDebgMac(GetInstance(), "Sending data poll"); + otLogDebgMac("Sending data poll"); if (mNoBufferRetxMode == true) { @@ -142,12 +142,12 @@ exit: break; case OT_ERROR_INVALID_STATE: - otLogWarnMac(GetInstance(), "Data poll tx requested while data polling was not enabled!"); + otLogWarnMac("Data poll tx requested while data polling was not enabled!"); StopPolling(); break; case OT_ERROR_ALREADY: - otLogDebgMac(GetInstance(), "Data poll tx requested when a previous data request still in send queue."); + otLogDebgMac("Data poll tx requested when a previous data request still in send queue."); ScheduleNextPoll(kUsePreviousPollPeriod); break; @@ -213,7 +213,7 @@ void DataPollManager::HandlePollSent(otError aError) shouldRecalculatePollPeriod = true; } - otLogInfoMac(GetInstance(), "Sent data poll"); + otLogInfoMac("Sent data poll"); break; @@ -226,7 +226,7 @@ void DataPollManager::HandlePollSent(otError aError) default: mPollTxFailureCounter++; - otLogInfoMac(GetInstance(), "Failed to send data poll, error:%s, retx:%d/%d", otThreadErrorToString(aError), + otLogInfoMac("Failed to send data poll, error:%s, retx:%d/%d", otThreadErrorToString(aError), mPollTxFailureCounter, kMaxPollRetxAttempts); if (mPollTxFailureCounter < kMaxPollRetxAttempts) @@ -266,7 +266,7 @@ void DataPollManager::HandlePollTimeout(void) mPollTimeoutCounter++; - otLogInfoMac(GetInstance(), "Data poll timeout, retry:%d/%d", mPollTimeoutCounter, kQuickPollsAfterTimeout); + otLogInfoMac("Data poll timeout, retry:%d/%d", mPollTimeoutCounter, kQuickPollsAfterTimeout); if (mPollTimeoutCounter < kQuickPollsAfterTimeout) { diff --git a/src/core/thread/energy_scan_server.cpp b/src/core/thread/energy_scan_server.cpp index 4b8c1ee58..ec976defe 100644 --- a/src/core/thread/energy_scan_server.cpp +++ b/src/core/thread/energy_scan_server.cpp @@ -113,7 +113,7 @@ void EnergyScanServer::HandleRequest(Coap::Header &aHeader, Message &aMessage, c if (aHeader.IsConfirmable() && !aMessageInfo.GetSockAddr().IsMulticast()) { SuccessOrExit(GetNetif().GetCoap().SendEmptyAck(aHeader, responseInfo)); - otLogInfoMeshCoP(GetInstance(), "sent energy scan query response"); + otLogInfoMeshCoP("sent energy scan query response"); } exit: @@ -213,7 +213,7 @@ otError EnergyScanServer::SendReport(void) messageInfo.SetPeerPort(kCoapUdpPort); SuccessOrExit(error = GetNetif().GetCoap().SendMessage(*message, messageInfo)); - otLogInfoMeshCoP(GetInstance(), "sent scan results"); + otLogInfoMeshCoP("sent scan results"); exit: diff --git a/src/core/thread/mesh_forwarder.cpp b/src/core/thread/mesh_forwarder.cpp index 95402a9ee..17eff1963 100644 --- a/src/core/thread/mesh_forwarder.cpp +++ b/src/core/thread/mesh_forwarder.cpp @@ -1691,21 +1691,20 @@ void MeshForwarder::LogIp6SourceDestAddresses(Ip6::Header &aIp6Header, { if (aSourcePort != 0) { - otLogMac(GetInstance(), aLogLevel, "\tsrc:[%s]:%d", aIp6Header.GetSource().ToString().AsCString(), aSourcePort); + otLogMac(aLogLevel, "\tsrc:[%s]:%d", aIp6Header.GetSource().ToString().AsCString(), aSourcePort); } else { - otLogMac(GetInstance(), aLogLevel, "\tsrc:[%s]", aIp6Header.GetSource().ToString().AsCString()); + otLogMac(aLogLevel, "\tsrc:[%s]", aIp6Header.GetSource().ToString().AsCString()); } if (aDestPort != 0) { - otLogMac(GetInstance(), aLogLevel, "\tdst:[%s]:%d", aIp6Header.GetDestination().ToString().AsCString(), - aDestPort); + otLogMac(aLogLevel, "\tdst:[%s]:%d", aIp6Header.GetDestination().ToString().AsCString(), aDestPort); } else { - otLogMac(GetInstance(), aLogLevel, "\tdst:[%s]", aIp6Header.GetDestination().ToString().AsCString()); + otLogMac(aLogLevel, "\tdst:[%s]", aIp6Header.GetDestination().ToString().AsCString()); } } #else @@ -1730,7 +1729,7 @@ void MeshForwarder::LogIp6Message(MessageAction aAction, shouldLogRss = (aAction == kMessageReceive) || (aAction == kMessageReassemblyDrop); - otLogMac(GetInstance(), aLogLevel, "%s IPv6 %s msg, len:%d, chksum:%04x%s%s, sec:%s%s%s, prio:%s%s%s", + otLogMac(aLogLevel, "%s IPv6 %s msg, len:%d, chksum:%04x%s%s, sec:%s%s%s, prio:%s%s%s", MessageActionToString(aAction, aError), Ip6::Ip6::IpProtoToString(ip6Header.GetNextHeader()), aMessage.GetLength(), checksum, (aMacAddress == NULL) ? "" : ((aAction == kMessageReceive) ? ", from:" : ", to:"), @@ -1796,12 +1795,12 @@ void MeshForwarder::LogFrame(const char *aActionText, const Mac::Frame &aFrame, { if (aError != OT_ERROR_NONE) { - otLogNoteMac(GetInstance(), "%s, aError:%s, %s", aActionText, otThreadErrorToString(aError), + otLogNoteMac("%s, aError:%s, %s", aActionText, otThreadErrorToString(aError), aFrame.ToInfoString().AsCString()); } else { - otLogInfoMac(GetInstance(), "%s, %s", aActionText, aFrame.ToInfoString().AsCString()); + otLogInfoMac("%s, %s", aActionText, aFrame.ToInfoString().AsCString()); } } @@ -1812,8 +1811,7 @@ void MeshForwarder::LogFragmentFrameDrop(otError aError, const Lowpan::FragmentHeader &aFragmentHeader, bool aIsSecure) { - otLogNoteMac(GetInstance(), - "Dropping rx frag frame, error:%s, len:%d, src:%s, dst:%s, tag:%d, offset:%d, dglen:%d, sec:%s", + otLogNoteMac("Dropping rx frag frame, error:%s, len:%d, src:%s, dst:%s, tag:%d, offset:%d, dglen:%d, sec:%s", otThreadErrorToString(aError), aFrameLength, aMacSource.ToString().AsCString(), aMacDest.ToString().AsCString(), aFragmentHeader.GetDatagramTag(), aFragmentHeader.GetDatagramOffset(), aFragmentHeader.GetDatagramSize(), aIsSecure ? "yes" : "no"); @@ -1825,9 +1823,9 @@ void MeshForwarder::LogLowpanHcFrameDrop(otError aError, const Mac::Address &aMacDest, bool aIsSecure) { - otLogNoteMac(GetInstance(), "Dropping rx lowpan HC frame, error:%s, len:%d, src:%s, dst:%s, sec:%s", - otThreadErrorToString(aError), aFrameLength, aMacSource.ToString().AsCString(), - aMacDest.ToString().AsCString(), aIsSecure ? "yes" : "no"); + otLogNoteMac("Dropping rx lowpan HC frame, error:%s, len:%d, src:%s, dst:%s, sec:%s", otThreadErrorToString(aError), + aFrameLength, aMacSource.ToString().AsCString(), aMacDest.ToString().AsCString(), + aIsSecure ? "yes" : "no"); } #else // #if (OPENTHREAD_CONFIG_LOG_LEVEL >= OT_LOG_LEVEL_INFO) && (OPENTHREAD_CONFIG_LOG_MAC == 1) diff --git a/src/core/thread/mesh_forwarder_ftd.cpp b/src/core/thread/mesh_forwarder_ftd.cpp index ed0da08b1..ede314d6e 100644 --- a/src/core/thread/mesh_forwarder_ftd.cpp +++ b/src/core/thread/mesh_forwarder_ftd.cpp @@ -579,8 +579,7 @@ void MeshForwarder::HandleDataRequest(const Mac::Address &aMacSource, const otTh mScheduleTransmissionTask.Post(); - otLogInfoMac(GetInstance(), "Rx data poll, src:0x%04x, qed_msgs:%d, rss:%d", child->GetRloc16(), indirectMsgCount, - aLinkInfo.mRss); + otLogInfoMac("Rx data poll, src:0x%04x, qed_msgs:%d, rss:%d", child->GetRloc16(), indirectMsgCount, aLinkInfo.mRss); exit: return; @@ -624,7 +623,7 @@ void MeshForwarder::HandleSentFrameToChild(const Mac::Frame &aFrame, otError aEr case OT_ERROR_CHANNEL_ACCESS_FAILURE: case OT_ERROR_ABORT: - otLogInfoMac(GetInstance(), "Indirect tx to child %04x failed, attempt %d/%d, error:%s", child->GetRloc16(), + otLogInfoMac("Indirect tx to child %04x failed, attempt %d/%d, error:%s", child->GetRloc16(), child->GetIndirectTxAttempts(), kMaxPollTriggeredTxAttempts, otThreadErrorToString(aError)); if (child->GetIndirectTxAttempts() < kMaxPollTriggeredTxAttempts) @@ -985,9 +984,8 @@ exit: if (error != OT_ERROR_NONE) { - otLogInfoMac(GetInstance(), "Dropping rx mesh frame, error:%s, len:%d, src:%s, sec:%s", - otThreadErrorToString(error), aFrameLength, aMacSource.ToString().AsCString(), - aLinkInfo.mLinkSecurity ? "yes" : "no"); + otLogInfoMac("Dropping rx mesh frame, error:%s, len:%d, src:%s, sec:%s", otThreadErrorToString(error), + aFrameLength, aMacSource.ToString().AsCString(), aLinkInfo.mLinkSecurity ? "yes" : "no"); if (message != NULL) { @@ -1117,7 +1115,7 @@ otError MeshForwarder::LogMeshFragmentHeader(MessageAction aAction, shouldLogRss = (aAction == kMessageReceive) || (aAction == kMessageReassemblyDrop); otLogMac( - GetInstance(), aLogLevel, "%s mesh frame, len:%d%s%s, msrc:%s, mdst:%s, hops:%d, frag:%s, sec:%s%s%s%s%s", + aLogLevel, "%s mesh frame, len:%d%s%s, msrc:%s, mdst:%s, hops:%d, frag:%s, sec:%s%s%s%s%s", MessageActionToString(aAction, aError), aMessage.GetLength(), (aMacAddress == NULL) ? "" : ((aAction == kMessageReceive) ? ", from:" : ", to:"), (aMacAddress == NULL) ? "" : aMacAddress->ToString().AsCString(), aMeshSource.ToString().AsCString(), @@ -1128,7 +1126,7 @@ otError MeshForwarder::LogMeshFragmentHeader(MessageAction aAction, if (hasFragmentHeader) { - otLogMac(GetInstance(), aLogLevel, "\tFrag tag:%04x, offset:%d, size:%d", fragmentHeader.GetDatagramTag(), + otLogMac(aLogLevel, "\tFrag tag:%04x, offset:%d, size:%d", fragmentHeader.GetDatagramTag(), fragmentHeader.GetDatagramOffset(), fragmentHeader.GetDatagramSize()); VerifyOrExit(fragmentHeader.GetDatagramOffset() == 0); @@ -1227,8 +1225,8 @@ void MeshForwarder::LogMeshIpHeader(const Message & aMessage, SuccessOrExit(DecompressIp6UdpTcpHeader(aMessage, aOffset, aMeshSource, aMeshDest, ip6Header, checksum, sourcePort, destPort)); - otLogMac(GetInstance(), aLogLevel, "\tIPv6 %s msg, chksum:%04x, prio:%s", - Ip6::Ip6::IpProtoToString(ip6Header.GetNextHeader()), checksum, MessagePriorityToString(aMessage)); + otLogMac(aLogLevel, "\tIPv6 %s msg, chksum:%04x, prio:%s", Ip6::Ip6::IpProtoToString(ip6Header.GetNextHeader()), + checksum, MessagePriorityToString(aMessage)); LogIp6SourceDestAddresses(ip6Header, sourcePort, destPort, aLogLevel); diff --git a/src/core/thread/mle.cpp b/src/core/thread/mle.cpp index 6a8441893..186f271d2 100644 --- a/src/core/thread/mle.cpp +++ b/src/core/thread/mle.cpp @@ -303,7 +303,7 @@ void Mle::SetRole(otDeviceRole aRole) { VerifyOrExit(aRole != mRole, GetNotifier().SignalIfFirst(OT_CHANGED_THREAD_ROLE)); - otLogNoteMle(GetInstance(), "Role %s -> %s", RoleToString(mRole), RoleToString(aRole)); + otLogNoteMle("Role %s -> %s", RoleToString(mRole), RoleToString(aRole)); mRole = aRole; GetNotifier().Signal(OT_CHANGED_THREAD_ROLE); @@ -346,7 +346,7 @@ exit: void Mle::SetAttachState(AttachState aState) { VerifyOrExit(aState != mAttachState); - otLogInfoMle(GetInstance(), "AttachState %s -> %s", AttachStateToString(mAttachState), AttachStateToString(aState)); + otLogInfoMle("AttachState %s -> %s", AttachStateToString(mAttachState), AttachStateToString(aState)); mAttachState = aState; exit: @@ -406,7 +406,7 @@ otError Mle::Restore(void) // setting by skipping the re-attach ("Child Update Request" // exchange) and going through the full attach process. - otLogWarnMle(GetInstance(), "Invalid settings - no saved parent info with valid end-device RLOC16 0x%04x", + otLogWarnMle("Invalid settings - no saved parent info with valid end-device RLOC16 0x%04x", networkInfo.mRloc16); ExitNow(); } @@ -481,7 +481,7 @@ otError Mle::Store(void) netif.GetKeyManager().SetStoredMleFrameCounter(networkInfo.mMleFrameCounter); netif.GetKeyManager().SetStoredMacFrameCounter(networkInfo.mMacFrameCounter); - otLogDebgMle(GetInstance(), "Store Network Information"); + otLogDebgMle("Store Network Information"); exit: return error; @@ -683,8 +683,8 @@ uint32_t Mle::GetAttachStartDelay(void) const delay += jitter; } - otLogNoteMle(GetInstance(), "Attach attempt %d unsuccessful, will try again in %u.%03u seconds", mAttachCounter, - delay / 1000, delay % 1000); + otLogNoteMle("Attach attempt %d unsuccessful, will try again in %u.%03u seconds", mAttachCounter, delay / 1000, + delay % 1000); exit: return delay; @@ -813,8 +813,8 @@ otError Mle::SetDeviceMode(uint8_t aDeviceMode) error = OT_ERROR_INVALID_ARGS); VerifyOrExit(mDeviceMode != aDeviceMode); - otLogNoteMle(GetInstance(), "Mode 0x%02x -> 0x%02x [rx-on:%s, sec-data-req:%s, ftd:%s, full-netdata:%s]", - mDeviceMode, aDeviceMode, (aDeviceMode & ModeTlv::kModeRxOnWhenIdle) ? "yes" : " no", + otLogNoteMle("Mode 0x%02x -> 0x%02x [rx-on:%s, sec-data-req:%s, ftd:%s, full-netdata:%s]", mDeviceMode, aDeviceMode, + (aDeviceMode & ModeTlv::kModeRxOnWhenIdle) ? "yes" : " no", (aDeviceMode & ModeTlv::kModeSecureDataRequest) ? "yes" : " no", (aDeviceMode & ModeTlv::kModeFullThreadDevice) ? "yes" : "no", (aDeviceMode & ModeTlv::kModeFullNetworkData) ? "yes" : "no"); @@ -1609,12 +1609,12 @@ void Mle::HandleAttachTimer(void) case kAttachStateStart: if (mAttachCounter > 0) { - otLogNoteMle(GetInstance(), "Attempt to attach - attempt %d, %s %s", mAttachCounter, + otLogNoteMle("Attempt to attach - attempt %d, %s %s", mAttachCounter, AttachModeToString(mParentRequestMode), ReattachStateToString(mReattachState)); } else { - otLogNoteMle(GetInstance(), "Attempt to attach - %s %s", AttachModeToString(mParentRequestMode), + otLogNoteMle("Attempt to attach - %s %s", AttachModeToString(mParentRequestMode), ReattachStateToString(mReattachState)); } @@ -1944,7 +1944,7 @@ otError Mle::SendChildIdRequest(void) { if (mRole == OT_DEVICE_ROLE_CHILD) { - otLogInfoMle(GetInstance(), "Already attached to candidate parent"); + otLogInfoMle("Already attached to candidate parent"); ExitNow(error = OT_ERROR_ALREADY); } else @@ -2173,7 +2173,7 @@ otError Mle::SendChildUpdateRequest(void) if (!mParent.IsStateValidOrRestoring()) { - otLogWarnMle(GetInstance(), "No valid parent when sending Child Update Request"); + otLogWarnMle("No valid parent when sending Child Update Request"); BecomeDetached(); ExitNow(); } @@ -2347,7 +2347,7 @@ otError Mle::SendAnnounce(uint8_t aChannel, bool aOrphanAnnounce, const Ip6::Add SuccessOrExit(error = message->Append(&panid, sizeof(panid))); SuccessOrExit(error = SendMessage(*message, aDestination)); - otLogInfoMle(GetInstance(), "Send Announce on channel %d", aChannel); + otLogInfoMle("Send Announce on channel %d", aChannel); exit: @@ -2630,7 +2630,7 @@ void Mle::HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &aMessageIn { if (frameCounter < neighbor->GetMleFrameCounter()) { - otLogDebgMle(GetInstance(), "mle frame reject 1"); + otLogDebgMle("mle frame reject 1"); ExitNow(); } } @@ -2638,7 +2638,7 @@ void Mle::HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &aMessageIn { if (keySequence <= neighbor->GetKeySequence()) { - otLogDebgMle(GetInstance(), "mle frame reject 2"); + otLogDebgMle("mle frame reject 2"); ExitNow(); } @@ -2656,7 +2656,7 @@ void Mle::HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &aMessageIn command == Header::kCommandChildIdRequest || command == Header::kCommandChildUpdateRequest || command == Header::kCommandChildUpdateResponse || command == Header::kCommandAnnounce)) { - otLogDebgMle(GetInstance(), "mle sequence unknown! %d", command); + otLogDebgMle("mle sequence unknown! %d", command); ExitNow(); } } @@ -2852,7 +2852,7 @@ otError Mle::HandleDataResponse(const Message &aMessage, const Ip6::MessageInfo if (error != OT_ERROR_NONE) { - otLogWarnMleErr(GetInstance(), error, "Failed to process Data Response"); + otLogWarnMleErr(error, "Failed to process Data Response"); } return error; @@ -3266,7 +3266,7 @@ exit: if (error != OT_ERROR_NONE) { - otLogWarnMleErr(GetInstance(), error, "Failed to process Parent Response"); + otLogWarnMleErr(error, "Failed to process Parent Response"); } return error; @@ -3388,7 +3388,7 @@ exit: if (error != OT_ERROR_NONE) { - otLogWarnMleErr(GetInstance(), error, "Failed to process Child ID Response"); + otLogWarnMleErr(error, "Failed to process Child ID Response"); } OT_UNUSED_VARIABLE(aMessageInfo); @@ -3565,7 +3565,7 @@ exit: if (error != OT_ERROR_NONE) { - otLogWarnMleErr(GetInstance(), error, "Failed to process Child Update Response"); + otLogWarnMleErr(error, "Failed to process Child Update Response"); } return error; @@ -3618,7 +3618,7 @@ otError Mle::HandleAnnounce(const Message &aMessage, const Ip6::MessageInfo &aMe SetAttachState(kAttachStateProcessAnnounce); mAttachTimer.Start(kAnnounceProcessTimeout); - otLogNoteMle(GetInstance(), "Delay processing Announce - channel %d, panid 0x%02x", channel, panId); + otLogNoteMle("Delay processing Announce - channel %d, panid 0x%02x", channel, panId); } else if (localTimestamp->Compare(timestamp) < 0) { @@ -3649,7 +3649,7 @@ void Mle::ProcessAnnounce(void) assert(mAttachState == kAttachStateProcessAnnounce); - otLogNoteMle(GetInstance(), "Processing Announce - channel %d, panid 0x%02x", newChannel, newPanId); + otLogNoteMle("Processing Announce - channel %d, panid 0x%02x", newChannel, newPanId); Stop(/* aClearNetworkDatasets */ false); @@ -3780,7 +3780,7 @@ exit: if (error != OT_ERROR_NONE) { - otLogWarnMleErr(GetInstance(), error, "Failed to process Discovery Response"); + otLogWarnMleErr(error, "Failed to process Discovery Response"); } return error; @@ -3934,13 +3934,13 @@ otError Mle::InformPreviousParent(void) SuccessOrExit(error = netif.GetIp6().SendDatagram(*message, messageInfo, Ip6::kProtoNone)); - otLogNoteMle(GetInstance(), "Sending message to inform previous parent 0x%04x", mPreviousParentRloc); + otLogNoteMle("Sending message to inform previous parent 0x%04x", mPreviousParentRloc); exit: if (error != OT_ERROR_NONE) { - otLogWarnMle(GetInstance(), "Failed to inform previous parent, error:%s", otThreadErrorToString(error)); + otLogWarnMle("Failed to inform previous parent, error:%s", otThreadErrorToString(error)); if (message != NULL) { @@ -3962,8 +3962,7 @@ void Mle::HandleParentSearchTimer(void) { int8_t parentRss; - otLogInfoMle(GetInstance(), "PeriodicParentSearch: %s interval passed", - mParentSearchIsInBackoff ? "Backoff" : "Check"); + otLogInfoMle("PeriodicParentSearch: %s interval passed", mParentSearchIsInBackoff ? "Backoff" : "Check"); if (mParentSearchBackoffWasCanceled) { @@ -3974,7 +3973,7 @@ void Mle::HandleParentSearchTimer(void) if (TimerMilli::GetNow() - mParentSearchBackoffCancelTime >= kParentSearchBackoffInterval) { mParentSearchBackoffWasCanceled = false; - otLogInfoMle(GetInstance(), "PeriodicParentSearch: Backoff cancellation is allowed on parent switch"); + otLogInfoMle("PeriodicParentSearch: Backoff cancellation is allowed on parent switch"); } } @@ -3983,12 +3982,12 @@ void Mle::HandleParentSearchTimer(void) VerifyOrExit(mRole == OT_DEVICE_ROLE_CHILD); parentRss = GetParent()->GetLinkInfo().GetAverageRss(); - otLogInfoMle(GetInstance(), "PeriodicParentSearch: Parent RSS %d", parentRss); + otLogInfoMle("PeriodicParentSearch: Parent RSS %d", parentRss); VerifyOrExit(parentRss != OT_RADIO_RSSI_INVALID); if (parentRss < kParentSearchRssThreadhold) { - otLogInfoMle(GetInstance(), "PeriodicParentSearch: Parent RSS less than %d, searching for new parents", + otLogInfoMle("PeriodicParentSearch: Parent RSS less than %d, searching for new parents", kParentSearchRssThreadhold); mParentSearchIsInBackoff = true; BecomeChild(kAttachAny); @@ -4015,7 +4014,7 @@ void Mle::StartParentSearchTimer(void) mParentSearchTimer.Start(interval); - otLogInfoMle(GetInstance(), "PeriodicParentSearch: (Re)starting timer for %s interval", + otLogInfoMle("PeriodicParentSearch: (Re)starting timer for %s interval", mParentSearchIsInBackoff ? "backoff" : "check"); } @@ -4045,7 +4044,7 @@ void Mle::UpdateParentSearchState(void) mParentSearchIsInBackoff = false; mParentSearchBackoffWasCanceled = true; mParentSearchBackoffCancelTime = TimerMilli::GetNow(); - otLogInfoMle(GetInstance(), "PeriodicParentSearch: Canceling backoff on switching to a new parent"); + otLogInfoMle("PeriodicParentSearch: Canceling backoff on switching to a new parent"); } } @@ -4062,7 +4061,7 @@ void Mle::UpdateParentSearchState(void) void Mle::LogMleMessage(const char *aLogString, const Ip6::Address &aAddress) const { - otLogInfoMle(GetInstance(), "%s (%s)", aLogString, aAddress.ToString().AsCString()); + otLogInfoMle("%s (%s)", aLogString, aAddress.ToString().AsCString()); OT_UNUSED_VARIABLE(aLogString); OT_UNUSED_VARIABLE(aAddress); @@ -4070,7 +4069,7 @@ void Mle::LogMleMessage(const char *aLogString, const Ip6::Address &aAddress) co void Mle::LogMleMessage(const char *aLogString, const Ip6::Address &aAddress, uint16_t aRloc) const { - otLogInfoMle(GetInstance(), "%s (%s,0x%04x)", aLogString, aAddress.ToString().AsCString(), aRloc); + otLogInfoMle("%s (%s,0x%04x)", aLogString, aAddress.ToString().AsCString(), aRloc); OT_UNUSED_VARIABLE(aLogString); OT_UNUSED_VARIABLE(aAddress); diff --git a/src/core/thread/mle_router.cpp b/src/core/thread/mle_router.cpp index 864ec5ff0..7c28f5240 100644 --- a/src/core/thread/mle_router.cpp +++ b/src/core/thread/mle_router.cpp @@ -140,7 +140,7 @@ otError MleRouter::BecomeRouter(ThreadStatusTlv::Status aStatus) VerifyOrExit(mRole != OT_DEVICE_ROLE_ROUTER, error = OT_ERROR_NONE); VerifyOrExit(IsRouterRoleEnabled(), error = OT_ERROR_NOT_CAPABLE); - otLogInfoMle(GetInstance(), "Attempt to become router"); + otLogInfoMle("Attempt to become router"); netif.GetMeshForwarder().SetRxOnWhenIdle(true); mRouterSelectionJitterTimeout = 0; @@ -374,7 +374,7 @@ otError MleRouter::SetStateLeader(uint16_t aRloc16) } } - otLogNoteMle(GetInstance(), "Leader partition id 0x%x", mLeaderData.GetPartitionId()); + otLogNoteMle("Leader partition id 0x%x", mLeaderData.GetPartitionId()); return OT_ERROR_NONE; } @@ -1203,7 +1203,7 @@ otError MleRouter::HandleAdvertisement(const Message &aMessage, const Ip6::Messa if (partitionId != mLeaderData.GetPartitionId()) { - otLogNoteMle(GetInstance(), "Different partition (peer:%d, local:%d)", leaderData.GetPartitionId(), + otLogNoteMle("Different partition (peer:%d, local:%d)", leaderData.GetPartitionId(), mLeaderData.GetPartitionId()); VerifyOrExit(linkMargin >= OPENTHREAD_CONFIG_MLE_PARTITION_MERGE_MARGIN_MIN, error = OT_ERROR_LINK_MARGIN_LOW); @@ -1236,7 +1236,7 @@ otError MleRouter::HandleAdvertisement(const Message &aMessage, const Ip6::Messa { if (mRole != OT_DEVICE_ROLE_CHILD) { - otLogInfoMle(GetInstance(), "Leader ID mismatch"); + otLogInfoMle("Leader ID mismatch"); BecomeDetached(); error = OT_ERROR_DROP; } @@ -1550,13 +1550,13 @@ void MleRouter::UpdateRoutes(const RouteTlv &aRoute, uint8_t aRouterId) #if (OPENTHREAD_CONFIG_LOG_MLE && (OPENTHREAD_CONFIG_LOG_LEVEL >= OT_LOG_LEVEL_INFO)) VerifyOrExit(changed); - otLogInfoMle(GetInstance(), "Route table updated"); + otLogInfoMle("Route table updated"); for (RouterTable::Iterator iter(GetInstance()); !iter.IsDone(); iter++) { Router &router = *iter.GetRouter(); - otLogInfoMle(GetInstance(), "\t%04x -> %04x, cost:%d %d, lqin:%d, lqout:%d", router.GetRloc16(), + otLogInfoMle("\t%04x -> %04x, cost:%d %d, lqin:%d, lqout:%d", router.GetRloc16(), GetRloc16(router.GetNextHop()), router.GetCost(), mRouterTable.GetLinkCost(router), router.GetLinkInfo().GetLinkQuality(), router.GetLinkQualityOut()); } @@ -1754,18 +1754,18 @@ void MleRouter::HandleStateUpdateTimer(void) case OT_DEVICE_ROLE_ROUTER: // verify path to leader - otLogDebgMle(GetInstance(), "network id timeout = %d", mRouterTable.GetLeaderAge()); + otLogDebgMle("network id timeout = %d", mRouterTable.GetLeaderAge()); if ((mRouterTable.GetActiveRouterCount() > 0) && (mRouterTable.GetLeaderAge() >= mNetworkIdTimeout)) { - otLogInfoMle(GetInstance(), "Router ID Sequence timeout"); + otLogInfoMle("Router ID Sequence timeout"); BecomeChild(kAttachSame1); } if (routerStateUpdate && mRouterTable.GetActiveRouterCount() > mRouterDowngradeThreshold) { // downgrade to REED - otLogNoteMle(GetInstance(), "Downgrade to REED"); + otLogNoteMle("Downgrade to REED"); BecomeChild(kAttachSameDowngrade); } @@ -1802,7 +1802,7 @@ void MleRouter::HandleStateUpdateTimer(void) if ((TimerMilli::GetNow() - child.GetLastHeard()) >= timeout) { - otLogInfoMle(GetInstance(), "Child timeout expired"); + otLogInfoMle("Child timeout expired"); RemoveNeighbor(child); } else if ((mRole == OT_DEVICE_ROLE_ROUTER || mRole == OT_DEVICE_ROLE_LEADER) && @@ -1832,7 +1832,7 @@ void MleRouter::HandleStateUpdateTimer(void) if (age >= TimerMilli::SecToMsec(kMaxNeighborAge)) { - otLogInfoMle(GetInstance(), "Router timeout expired"); + otLogInfoMle("Router timeout expired"); RemoveNeighbor(router); continue; } @@ -1843,7 +1843,7 @@ void MleRouter::HandleStateUpdateTimer(void) { if (age < TimerMilli::SecToMsec(kMaxNeighborAge) + kMaxTransmissionCount * kUnicastRetransmissionDelay) { - otLogInfoMle(GetInstance(), "Router timeout expired"); + otLogInfoMle("Router timeout expired"); SendLinkRequest(&router); } else @@ -1859,7 +1859,7 @@ void MleRouter::HandleStateUpdateTimer(void) { if (age >= kMaxLinkRequestTimeout) { - otLogInfoMle(GetInstance(), "Link Request timeout expired"); + otLogInfoMle("Link Request timeout expired"); RemoveNeighbor(router); continue; } @@ -1871,7 +1871,7 @@ void MleRouter::HandleStateUpdateTimer(void) mRouterTable.GetLinkCost(router) >= kMaxRouteCost && age >= TimerMilli::SecToMsec(kMaxLeaderToRouterTimeout)) { - otLogInfoMle(GetInstance(), "Router ID timeout expired (no route)"); + otLogInfoMle("Router ID timeout expired (no route)"); mRouterTable.Release(router.GetRouterId()); } } @@ -1988,8 +1988,8 @@ otError MleRouter::UpdateChildAddresses(const Message &aMessage, uint16_t aOffse { if (GetNetif().GetNetworkDataLeader().GetContext(entry.GetContextId(), context) != OT_ERROR_NONE) { - otLogWarnMle(GetInstance(), "Failed to get context %d for compressed address from child 0x%04x", - entry.GetContextId(), aChild.GetRloc16()); + otLogWarnMle("Failed to get context %d for compressed address from child 0x%04x", entry.GetContextId(), + aChild.GetRloc16()); continue; } @@ -2009,12 +2009,12 @@ otError MleRouter::UpdateChildAddresses(const Message &aMessage, uint16_t aOffse if (error == OT_ERROR_NONE) { storedCount++; - otLogInfoMle(GetInstance(), "Child 0x%04x IPv6 address[%d]=%s", aChild.GetRloc16(), storedCount, + otLogInfoMle("Child 0x%04x IPv6 address[%d]=%s", aChild.GetRloc16(), storedCount, address.ToString().AsCString()); } else { - otLogWarnMle(GetInstance(), "Error %s adding IPv6 address %s to child 0x%04x", otThreadErrorToString(error), + otLogWarnMle("Error %s adding IPv6 address %s to child 0x%04x", otThreadErrorToString(error), address.ToString().AsCString(), aChild.GetRloc16()); } @@ -2046,13 +2046,12 @@ otError MleRouter::UpdateChildAddresses(const Message &aMessage, uint16_t aOffse if (registeredCount == 0) { - otLogInfoMle(GetInstance(), "Child 0x%04x has no registered IPv6 address", aChild.GetRloc16()); + otLogInfoMle("Child 0x%04x has no registered IPv6 address", aChild.GetRloc16()); } else { - otLogInfoMle(GetInstance(), "Child 0x%04x has %d registered IPv6 address%s, %d address%s stored", - aChild.GetRloc16(), registeredCount, (registeredCount == 1) ? "" : "es", storedCount, - (storedCount == 1) ? "" : "es"); + otLogInfoMle("Child 0x%04x has %d registered IPv6 address%s, %d address%s stored", aChild.GetRloc16(), + registeredCount, (registeredCount == 1) ? "" : "es", storedCount, (storedCount == 1) ? "" : "es"); } error = OT_ERROR_NONE; @@ -2273,8 +2272,7 @@ otError MleRouter::HandleChildUpdateRequest(const Message & aMessage, if (child->GetDeviceMode() != mode.GetMode()) { - otLogNoteMle(GetInstance(), - "Child 0x%04x mode change 0x%02x -> 0x%02x [rx-on:%s, sec-data-req:%s, ftd:%s, full-netdata:%s]", + otLogNoteMle("Child 0x%04x mode change 0x%02x -> 0x%02x [rx-on:%s, sec-data-req:%s, ftd:%s, full-netdata:%s]", child->GetRloc16(), child->GetDeviceMode(), mode.GetMode(), (mode.GetMode() & ModeTlv::kModeRxOnWhenIdle) ? "yes" : " no", (mode.GetMode() & ModeTlv::kModeSecureDataRequest) ? "yes" : " no", @@ -2702,7 +2700,7 @@ exit: if (error != OT_ERROR_NONE) { - otLogWarnMleErr(GetInstance(), error, "Failed to process Discovery Request"); + otLogWarnMleErr(error, "Failed to process Discovery Request"); } return error; @@ -3063,7 +3061,7 @@ otError MleRouter::SendDataResponse(const Ip6::Address &aDestination, if (mRetrieveNewNetworkData) { - otLogInfoMle(GetInstance(), "Suppressing Data Response - waiting for new network data"); + otLogInfoMle("Suppressing Data Response - waiting for new network data"); ExitNow(); } @@ -4098,7 +4096,7 @@ void MleRouter::HandleAddressSolicit(Coap::Header &aHeader, Message &aMessage, c } else { - otLogInfoMle(GetInstance(), "router id requested and provided!"); + otLogInfoMle("router id requested and provided!"); } if (router != NULL) @@ -4107,7 +4105,7 @@ void MleRouter::HandleAddressSolicit(Coap::Header &aHeader, Message &aMessage, c } else { - otLogInfoMle(GetInstance(), "router address unavailable!"); + otLogInfoMle("router address unavailable!"); } exit: diff --git a/src/core/thread/network_data.cpp b/src/core/thread/network_data.cpp index 524da97b9..6477d3b4c 100644 --- a/src/core/thread/network_data.cpp +++ b/src/core/thread/network_data.cpp @@ -566,7 +566,7 @@ void NetworkData::RemoveTemporaryData(uint8_t *aData, uint8_t &aDataLength) continue; } - otDumpDebgNetData(GetInstance(), "remove prefix done", mTlvs, mLength); + otDumpDebgNetData("remove prefix done", mTlvs, mLength); break; } @@ -587,7 +587,7 @@ void NetworkData::RemoveTemporaryData(uint8_t *aData, uint8_t &aDataLength) continue; } - otDumpDebgNetData(GetInstance(), "remove service done", mTlvs, mLength); + otDumpDebgNetData("remove service done", mTlvs, mLength); break; } @@ -613,7 +613,7 @@ void NetworkData::RemoveTemporaryData(uint8_t *aData, uint8_t &aDataLength) cur = cur->GetNext(); } - otDumpDebgNetData(GetInstance(), "remove done", aData, aDataLength); + otDumpDebgNetData("remove done", aData, aDataLength); } void NetworkData::RemoveTemporaryData(uint8_t *aData, uint8_t &aDataLength, PrefixTlv &aPrefix) @@ -1041,7 +1041,7 @@ otError NetworkData::SendServerDataNotification(uint16_t aRloc16) mLastAttemptWait = true; } - otLogInfoNetData(GetInstance(), "Sent server data notification"); + otLogInfoNetData("Sent server data notification"); exit: diff --git a/src/core/thread/network_data_leader.cpp b/src/core/thread/network_data_leader.cpp index 559b21bde..c63134837 100644 --- a/src/core/thread/network_data_leader.cpp +++ b/src/core/thread/network_data_leader.cpp @@ -429,7 +429,7 @@ otError LeaderBase::SetNetworkData(uint8_t aVersion, RemoveTemporaryData(mTlvs, mLength); } - otDumpDebgNetData(GetInstance(), "set network data", mTlvs, mLength); + otDumpDebgNetData("set network data", mTlvs, mLength); GetNotifier().Signal(OT_CHANGED_THREAD_NETDATA); diff --git a/src/core/thread/network_data_leader_ftd.cpp b/src/core/thread/network_data_leader_ftd.cpp index e29f7faf9..1b907a2b6 100644 --- a/src/core/thread/network_data_leader_ftd.cpp +++ b/src/core/thread/network_data_leader_ftd.cpp @@ -163,7 +163,7 @@ void Leader::HandleServerData(Coap::Header &aHeader, Message &aMessage, const Ip ThreadNetworkDataTlv networkData; ThreadRloc16Tlv rloc16; - otLogInfoNetData(GetInstance(), "Received network data registration"); + otLogInfoNetData("Received network data registration"); if (ThreadTlv::GetTlv(aMessage, ThreadTlv::kRloc16, sizeof(rloc16), rloc16) == OT_ERROR_NONE) { @@ -180,7 +180,7 @@ void Leader::HandleServerData(Coap::Header &aHeader, Message &aMessage, const Ip SuccessOrExit(GetNetif().GetCoap().SendEmptyAck(aHeader, aMessageInfo)); - otLogInfoNetData(GetInstance(), "Sent network data registration acknowledgment"); + otLogInfoNetData("Sent network data registration acknowledgment"); exit: return; @@ -391,7 +391,7 @@ void Leader::SendCommissioningGetResponse(const Coap::Header & aRequestHeader SuccessOrExit(error = netif.GetCoap().SendMessage(*message, aMessageInfo)); - otLogInfoMeshCoP(GetInstance(), "sent commissioning dataset get response"); + otLogInfoMeshCoP("sent commissioning dataset get response"); exit: @@ -423,7 +423,7 @@ void Leader::SendCommissioningSetResponse(const Coap::Header & aRequestHeade SuccessOrExit(error = netif.GetCoap().SendMessage(*message, aMessageInfo)); - otLogInfoMeshCoP(GetInstance(), "sent commissioning dataset set response"); + otLogInfoMeshCoP("sent commissioning dataset set response"); exit: @@ -831,14 +831,14 @@ otError Leader::AddNetworkData(uint8_t *aTlvs, uint8_t aTlvsLength, uint8_t *aOl { case NetworkDataTlv::kTypePrefix: SuccessOrExit(error = AddPrefix(*static_cast(cur))); - otDumpDebgNetData(GetInstance(), "add prefix done", mTlvs, mLength); + otDumpDebgNetData("add prefix done", mTlvs, mLength); break; #if OPENTHREAD_ENABLE_SERVICE case NetworkDataTlv::kTypeService: SuccessOrExit(error = AddService(*static_cast(cur), aOldTlvs, aOldTlvsLength)); - otDumpDebgNetData(GetInstance(), "add service done", mTlvs, mLength); + otDumpDebgNetData("add service done", mTlvs, mLength); break; #endif @@ -854,7 +854,7 @@ otError Leader::AddNetworkData(uint8_t *aTlvs, uint8_t aTlvsLength, uint8_t *aOl OT_UNUSED_VARIABLE(aOldTlvsLength); #endif - otDumpDebgNetData(GetInstance(), "add done", mTlvs, mLength); + otDumpDebgNetData("add done", mTlvs, mLength); exit: return error; @@ -1043,7 +1043,7 @@ otError Leader::AddServer(ServiceTlv &aService, ServerTlv &aServer, uint8_t *aOl } } - otLogInfoNetData(GetInstance(), "Allocated Service ID = %d", i); + otLogInfoNetData("Allocated Service ID = %d", i); VerifyOrExit(i <= Mle::kServiceMaxId, error = OT_ERROR_NO_BUFS); } @@ -1204,7 +1204,7 @@ int Leader::AllocateContext(void) { mContextUsed |= 1 << i; rval = i; - otLogInfoNetData(GetInstance(), "Allocated Context ID = %d", rval); + otLogInfoNetData("Allocated Context ID = %d", rval); ExitNow(); } } @@ -1215,7 +1215,7 @@ exit: otError Leader::FreeContext(uint8_t aContextId) { - otLogInfoNetData(GetInstance(), "Free Context Id = %d", aContextId); + otLogInfoNetData("Free Context Id = %d", aContextId); RemoveContext(aContextId); mContextUsed &= ~(1 << aContextId); mVersion++; @@ -1271,7 +1271,7 @@ otError Leader::RemoveRloc(uint16_t aRloc16, MatchMode aMatchMode) continue; } - otDumpDebgNetData(GetInstance(), "remove prefix done", mTlvs, mLength); + otDumpDebgNetData("remove prefix done", mTlvs, mLength); break; } @@ -1288,7 +1288,7 @@ otError Leader::RemoveRloc(uint16_t aRloc16, MatchMode aMatchMode) continue; } - otDumpDebgNetData(GetInstance(), "remove service done", mTlvs, mLength); + otDumpDebgNetData("remove service done", mTlvs, mLength); break; } @@ -1302,7 +1302,7 @@ otError Leader::RemoveRloc(uint16_t aRloc16, MatchMode aMatchMode) cur = cur->GetNext(); } - otDumpDebgNetData(GetInstance(), "remove done", mTlvs, mLength); + otDumpDebgNetData("remove done", mTlvs, mLength); return OT_ERROR_NONE; } @@ -1492,7 +1492,7 @@ otError Leader::RemoveContext(uint8_t aContextId) continue; } - otDumpDebgNetData(GetInstance(), "remove prefix done", mTlvs, mLength); + otDumpDebgNetData("remove prefix done", mTlvs, mLength); break; } @@ -1503,7 +1503,7 @@ otError Leader::RemoveContext(uint8_t aContextId) cur = cur->GetNext(); } - otDumpDebgNetData(GetInstance(), "remove done", mTlvs, mLength); + otDumpDebgNetData("remove done", mTlvs, mLength); return OT_ERROR_NONE; } diff --git a/src/core/thread/network_data_local.cpp b/src/core/thread/network_data_local.cpp index d6938de37..e741cf6ad 100644 --- a/src/core/thread/network_data_local.cpp +++ b/src/core/thread/network_data_local.cpp @@ -84,7 +84,7 @@ otError Local::AddOnMeshPrefix(const uint8_t *aPrefix, uint8_t aPrefixLength, in ClearResubmitDelayTimer(); - otDumpDebgNetData(GetInstance(), "add prefix done", mTlvs, mLength); + otDumpDebgNetData("add prefix done", mTlvs, mLength); exit: return error; @@ -101,7 +101,7 @@ otError Local::RemoveOnMeshPrefix(const uint8_t *aPrefix, uint8_t aPrefixLength) ClearResubmitDelayTimer(); exit: - otDumpDebgNetData(GetInstance(), "remove done", mTlvs, mLength); + otDumpDebgNetData("remove done", mTlvs, mLength); return error; } @@ -132,7 +132,7 @@ otError Local::AddHasRoutePrefix(const uint8_t *aPrefix, uint8_t aPrefixLength, ClearResubmitDelayTimer(); - otDumpDebgNetData(GetInstance(), "add route done", mTlvs, mLength); + otDumpDebgNetData("add route done", mTlvs, mLength); return OT_ERROR_NONE; } @@ -147,7 +147,7 @@ otError Local::RemoveHasRoutePrefix(const uint8_t *aPrefix, uint8_t aPrefixLengt ClearResubmitDelayTimer(); exit: - otDumpDebgNetData(GetInstance(), "remove done", mTlvs, mLength); + otDumpDebgNetData("remove done", mTlvs, mLength); return error; } @@ -194,7 +194,7 @@ otError Local::AddService(uint32_t aEnterpriseNumber, ClearResubmitDelayTimer(); - otDumpDebgNetData(GetInstance(), "add service done", mTlvs, mLength); + otDumpDebgNetData("add service done", mTlvs, mLength); // exit: return error; @@ -211,7 +211,7 @@ otError Local::RemoveService(uint32_t aEnterpriseNumber, const uint8_t *aService ClearResubmitDelayTimer(); exit: - otDumpDebgNetData(GetInstance(), "remove service done", mTlvs, mLength); + otDumpDebgNetData("remove service done", mTlvs, mLength); return error; } #endif diff --git a/src/core/thread/network_diagnostic.cpp b/src/core/thread/network_diagnostic.cpp index 9fb167e69..618259360 100644 --- a/src/core/thread/network_diagnostic.cpp +++ b/src/core/thread/network_diagnostic.cpp @@ -129,7 +129,7 @@ otError NetworkDiagnostic::SendDiagnosticGet(const Ip6::Address &aDestination, SuccessOrExit(error = netif.GetCoap().SendMessage(*message, messageInfo, handler, this)); - otLogInfoNetDiag(GetInstance(), "Sent diagnostic get"); + otLogInfoNetDiag("Sent diagnostic get"); exit: @@ -160,7 +160,7 @@ void NetworkDiagnostic::HandleDiagnosticGetResponse(Coap::Header & aHea VerifyOrExit(aResult == OT_ERROR_NONE); VerifyOrExit(aHeader.GetCode() == OT_COAP_CODE_CHANGED); - otLogInfoNetDiag(GetInstance(), "Received diagnostic get response"); + otLogInfoNetDiag("Received diagnostic get response"); if (mReceiveDiagnosticGetCallback) { @@ -187,7 +187,7 @@ void NetworkDiagnostic::HandleDiagnosticGetAnswer(Coap::Header & aHeade { VerifyOrExit(aHeader.GetType() == OT_COAP_TYPE_CONFIRMABLE && aHeader.GetCode() == OT_COAP_CODE_POST); - otLogInfoNetDiag(GetInstance(), "Diagnostic get answer received"); + otLogInfoNetDiag("Diagnostic get answer received"); if (mReceiveDiagnosticGetCallback) { @@ -196,7 +196,7 @@ void NetworkDiagnostic::HandleDiagnosticGetAnswer(Coap::Header & aHeade SuccessOrExit(GetNetif().GetCoap().SendEmptyAck(aHeader, aMessageInfo)); - otLogInfoNetDiag(GetInstance(), "Sent diagnostic answer acknowledgment"); + otLogInfoNetDiag("Sent diagnostic answer acknowledgment"); exit: return; @@ -284,7 +284,7 @@ otError NetworkDiagnostic::FillRequestedTlvs(Message & aRequest, { VerifyOrExit(aRequest.Read(offset, sizeof(type), &type) == sizeof(type), error = OT_ERROR_DROP); - otLogInfoNetDiag(GetInstance(), "Type %d", type); + otLogInfoNetDiag("Type %d", type); switch (type) { @@ -468,7 +468,7 @@ void NetworkDiagnostic::HandleDiagnosticGetQuery(Coap::Header & aHeader VerifyOrExit(aHeader.GetCode() == OT_COAP_CODE_POST, error = OT_ERROR_DROP); - otLogInfoNetDiag(GetInstance(), "Received diagnostic get query"); + otLogInfoNetDiag("Received diagnostic get query"); VerifyOrExit((aMessage.Read(aMessage.GetOffset(), sizeof(NetworkDiagnosticTlv), &networkDiagnosticTlv) == sizeof(NetworkDiagnosticTlv)), @@ -483,7 +483,7 @@ void NetworkDiagnostic::HandleDiagnosticGetQuery(Coap::Header & aHeader { if (netif.GetCoap().SendEmptyAck(aHeader, aMessageInfo) == OT_ERROR_NONE) { - otLogInfoNetDiag(GetInstance(), "Sent diagnostic get query acknowledgment"); + otLogInfoNetDiag("Sent diagnostic get query acknowledgment"); } } @@ -512,7 +512,7 @@ void NetworkDiagnostic::HandleDiagnosticGetQuery(Coap::Header & aHeader SuccessOrExit(error = netif.GetCoap().SendMessage(*message, messageInfo, NULL, this)); - otLogInfoNetDiag(GetInstance(), "Sent diagnostic get answer"); + otLogInfoNetDiag("Sent diagnostic get answer"); exit: @@ -546,7 +546,7 @@ void NetworkDiagnostic::HandleDiagnosticGetRequest(Coap::Header & aHead VerifyOrExit(aHeader.GetType() == OT_COAP_TYPE_CONFIRMABLE && aHeader.GetCode() == OT_COAP_CODE_POST, error = OT_ERROR_DROP); - otLogInfoNetDiag(GetInstance(), "Received diagnostic get request"); + otLogInfoNetDiag("Received diagnostic get request"); VerifyOrExit((aMessage.Read(aMessage.GetOffset(), sizeof(NetworkDiagnosticTlv), &networkDiagnosticTlv) == sizeof(NetworkDiagnosticTlv)), @@ -571,7 +571,7 @@ void NetworkDiagnostic::HandleDiagnosticGetRequest(Coap::Header & aHead SuccessOrExit(error = netif.GetCoap().SendMessage(*message, messageInfo)); - otLogInfoNetDiag(GetInstance(), "Sent diagnostic get response"); + otLogInfoNetDiag("Sent diagnostic get response"); exit: @@ -618,7 +618,7 @@ otError NetworkDiagnostic::SendDiagnosticReset(const Ip6::Address &aDestination, SuccessOrExit(error = netif.GetCoap().SendMessage(*message, messageInfo)); - otLogInfoNetDiag(GetInstance(), "Sent network diagnostic reset"); + otLogInfoNetDiag("Sent network diagnostic reset"); exit: @@ -649,7 +649,7 @@ void NetworkDiagnostic::HandleDiagnosticReset(Coap::Header & aHeader, uint8_t type; NetworkDiagnosticTlv networkDiagnosticTlv; - otLogInfoNetDiag(GetInstance(), "Received diagnostic reset request"); + otLogInfoNetDiag("Received diagnostic reset request"); VerifyOrExit(aHeader.GetType() == OT_COAP_TYPE_CONFIRMABLE && aHeader.GetCode() == OT_COAP_CODE_POST); @@ -670,18 +670,18 @@ void NetworkDiagnostic::HandleDiagnosticReset(Coap::Header & aHeader, { case NetworkDiagnosticTlv::kMacCounters: netif.GetMac().ResetCounters(); - otLogInfoNetDiag(GetInstance(), "Received diagnostic reset type kMacCounters(9)"); + otLogInfoNetDiag("Received diagnostic reset type kMacCounters(9)"); break; default: - otLogInfoNetDiag(GetInstance(), "Received diagnostic reset other type %d not resetable", type); + otLogInfoNetDiag("Received diagnostic reset other type %d not resetable", type); break; } } SuccessOrExit(netif.GetCoap().SendEmptyAck(aHeader, aMessageInfo)); - otLogInfoNetDiag(GetInstance(), "Sent diagnostic reset acknowledgment"); + otLogInfoNetDiag("Sent diagnostic reset acknowledgment"); exit: return; diff --git a/src/core/thread/panid_query_server.cpp b/src/core/thread/panid_query_server.cpp index 587667cb9..5fa1ec3bc 100644 --- a/src/core/thread/panid_query_server.cpp +++ b/src/core/thread/panid_query_server.cpp @@ -92,7 +92,7 @@ void PanIdQueryServer::HandleQuery(Coap::Header &aHeader, Message &aMessage, con if (aHeader.IsConfirmable() && !aMessageInfo.GetSockAddr().IsMulticast()) { SuccessOrExit(GetNetif().GetCoap().SendEmptyAck(aHeader, responseInfo)); - otLogInfoMeshCoP(GetInstance(), "sent panid query response"); + otLogInfoMeshCoP("sent panid query response"); } exit: @@ -153,7 +153,7 @@ otError PanIdQueryServer::SendConflict(void) messageInfo.SetPeerPort(kCoapUdpPort); SuccessOrExit(error = netif.GetCoap().SendMessage(*message, messageInfo)); - otLogInfoMeshCoP(GetInstance(), "sent panid conflict"); + otLogInfoMeshCoP("sent panid conflict"); exit: diff --git a/src/core/thread/router_table.cpp b/src/core/thread/router_table.cpp index 8cb7c0ed4..60bef7622 100644 --- a/src/core/thread/router_table.cpp +++ b/src/core/thread/router_table.cpp @@ -249,7 +249,7 @@ Router *RouterTable::Allocate(uint8_t aRouterId) mRouterIdSequenceLastUpdated = TimerMilli::GetNow(); GetNetif().GetMle().ResetAdvertiseInterval(); - otLogNoteMle(GetInstance(), "Allocate router id %d", aRouterId); + otLogNoteMle("Allocate router id %d", aRouterId); exit: return rval; @@ -292,7 +292,7 @@ otError RouterTable::Release(uint8_t aRouterId) netif.GetNetworkDataLeader().RemoveBorderRouter(rloc16, NetworkData::Leader::kMatchModeRouterId); netif.GetMle().ResetAdvertiseInterval(); - otLogNoteMle(GetInstance(), "Release router id %d", aRouterId); + otLogNoteMle("Release router id %d", aRouterId); exit: return error; diff --git a/src/core/thread/src_match_controller.cpp b/src/core/thread/src_match_controller.cpp index 95050dee2..4899b64ba 100644 --- a/src/core/thread/src_match_controller.cpp +++ b/src/core/thread/src_match_controller.cpp @@ -65,8 +65,7 @@ void SourceMatchController::DecrementMessageCount(Child &aChild) { if (aChild.GetIndirectMessageCount() == 0) { - otLogWarnMac(GetInstance(), "DecrementMessageCount(child 0x%04x) called when already at zero count.", - aChild.GetRloc16()); + otLogWarnMac("DecrementMessageCount(child 0x%04x) called when already at zero count.", aChild.GetRloc16()); ExitNow(); } @@ -110,14 +109,14 @@ void SourceMatchController::ClearTable(void) { otPlatRadioClearSrcMatchShortEntries(&GetInstance()); otPlatRadioClearSrcMatchExtEntries(&GetInstance()); - otLogDebgMac(GetInstance(), "SrcAddrMatch - Cleared all entries"); + otLogDebgMac("SrcAddrMatch - Cleared all entries"); } void SourceMatchController::Enable(bool aEnable) { mEnabled = aEnable; otPlatRadioEnableSrcMatch(&GetInstance(), mEnabled); - otLogDebgMac(GetInstance(), "SrcAddrMatch - %sabling", mEnabled ? "En" : "Dis"); + otLogDebgMac("SrcAddrMatch - %sabling", mEnabled ? "En" : "Dis"); } void SourceMatchController::AddEntry(Child &aChild) @@ -147,7 +146,7 @@ otError SourceMatchController::AddAddress(const Child &aChild) { error = otPlatRadioAddSrcMatchShortEntry(&GetInstance(), aChild.GetRloc16()); - otLogDebgMac(GetInstance(), "SrcAddrMatch - Adding short addr: 0x%04x -- %s (%d)", aChild.GetRloc16(), + otLogDebgMac("SrcAddrMatch - Adding short addr: 0x%04x -- %s (%d)", aChild.GetRloc16(), otThreadErrorToString(error), error); } else @@ -161,8 +160,8 @@ otError SourceMatchController::AddAddress(const Child &aChild) error = otPlatRadioAddSrcMatchExtEntry(&GetInstance(), &addr); - otLogDebgMac(GetInstance(), "SrcAddrMatch - Adding addr: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x -- %s (%d)", - addr.m8[7], addr.m8[6], addr.m8[5], addr.m8[4], addr.m8[3], addr.m8[2], addr.m8[1], addr.m8[0], + otLogDebgMac("SrcAddrMatch - Adding addr: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x -- %s (%d)", addr.m8[7], + addr.m8[6], addr.m8[5], addr.m8[4], addr.m8[3], addr.m8[2], addr.m8[1], addr.m8[0], otThreadErrorToString(error), error); } @@ -175,7 +174,7 @@ void SourceMatchController::ClearEntry(Child &aChild) if (aChild.IsIndirectSourceMatchPending()) { - otLogDebgMac(GetInstance(), "SrcAddrMatch - Clearing pending flag for 0x%04x", aChild.GetRloc16()); + otLogDebgMac("SrcAddrMatch - Clearing pending flag for 0x%04x", aChild.GetRloc16()); aChild.SetIndirectSourceMatchPending(false); ExitNow(); } @@ -184,7 +183,7 @@ void SourceMatchController::ClearEntry(Child &aChild) { error = otPlatRadioClearSrcMatchShortEntry(&GetInstance(), aChild.GetRloc16()); - otLogDebgMac(GetInstance(), "SrcAddrMatch - Clearing short address: 0x%04x -- %s (%d)", aChild.GetRloc16(), + otLogDebgMac("SrcAddrMatch - Clearing short address: 0x%04x -- %s (%d)", aChild.GetRloc16(), otThreadErrorToString(error), error); } else @@ -198,8 +197,8 @@ void SourceMatchController::ClearEntry(Child &aChild) error = otPlatRadioClearSrcMatchExtEntry(&GetInstance(), &addr); - otLogDebgMac(GetInstance(), "SrcAddrMatch - Clearing addr: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x -- %s (%d)", - addr.m8[7], addr.m8[6], addr.m8[5], addr.m8[4], addr.m8[3], addr.m8[2], addr.m8[1], addr.m8[0], + otLogDebgMac("SrcAddrMatch - Clearing addr: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x -- %s (%d)", addr.m8[7], + addr.m8[6], addr.m8[5], addr.m8[4], addr.m8[3], addr.m8[2], addr.m8[1], addr.m8[0], otThreadErrorToString(error), error); } diff --git a/src/core/utils/channel_manager.cpp b/src/core/utils/channel_manager.cpp index 1853f4acf..f8f215b5f 100644 --- a/src/core/utils/channel_manager.cpp +++ b/src/core/utils/channel_manager.cpp @@ -65,11 +65,11 @@ ChannelManager::ChannelManager(Instance &aInstance) void ChannelManager::RequestChannelChange(uint8_t aChannel) { - otLogInfoUtil(GetInstance(), "ChannelManager: Request to change to channel %d with delay %d sec", aChannel, mDelay); + otLogInfoUtil("ChannelManager: Request to change to channel %d with delay %d sec", aChannel, mDelay); if (aChannel == GetInstance().Get().GetPanChannel()) { - otLogInfoUtil(GetInstance(), "ChannelManager: Already operating on the requested channel %d", aChannel); + otLogInfoUtil("ChannelManager: Already operating on the requested channel %d", aChannel); ExitNow(); } @@ -149,8 +149,7 @@ void ChannelManager::PreparePendingDataset(void) } else { - otLogInfoUtil(GetInstance(), "ChannelManager: Request to change to channel %d failed. Device is disabled", - mChannel); + otLogInfoUtil("ChannelManager: Request to change to channel %d failed. Device is disabled", mChannel); mState = kStateIdle; StartAutoSelectTimer(); @@ -169,7 +168,7 @@ void ChannelManager::PreparePendingDataset(void) { if (dataset.mActiveTimestamp < pendingActiveTimestamp) { - otLogInfoUtil(GetInstance(), "ChannelManager: Pending Dataset is valid for change channel to %d", mChannel); + otLogInfoUtil("ChannelManager: Pending Dataset is valid for change channel to %d", mChannel); mState = kStateSentMgmtPendingDataset; mTimer.Start(delayInMs + kChangeCheckWaitInterval); ExitNow(); @@ -188,8 +187,7 @@ void ChannelManager::PreparePendingDataset(void) { if (dataset.mActiveTimestamp >= mActiveTimestamp) { - otLogInfoUtil(GetInstance(), - "ChannelManager: Canceling channel change to %d since current ActiveDataset is more recent", + otLogInfoUtil("ChannelManager: Canceling channel change to %d since current ActiveDataset is more recent", mChannel); ExitNow(); @@ -213,14 +211,14 @@ void ChannelManager::PreparePendingDataset(void) if (error == OT_ERROR_NONE) { - otLogInfoUtil(GetInstance(), "ChannelManager: Sent PendingDatasetSet to change channel to %d", mChannel); + otLogInfoUtil("ChannelManager: Sent PendingDatasetSet to change channel to %d", mChannel); mState = kStateSentMgmtPendingDataset; mTimer.Start(delayInMs + kChangeCheckWaitInterval); } else { - otLogInfoUtil(GetInstance(), "ChannelManager: %s error in dataset update (channel change %d), retry in %d sec", + otLogInfoUtil("ChannelManager: %s error in dataset update (channel change %d), retry in %d sec", otThreadErrorToString(error), mChannel, TimerMilli::MsecToSec(kPendingDatasetTxRetryInterval)); mTimer.Start(kPendingDatasetTxRetryInterval); @@ -240,13 +238,13 @@ void ChannelManager::HandleTimer(void) switch (mState) { case kStateIdle: - otLogInfoUtil(GetInstance(), "ChannelManager: Auto-triggered channel select"); + otLogInfoUtil("ChannelManager: Auto-triggered channel select"); IgnoreReturnValue(RequestChannelSelect(false)); StartAutoSelectTimer(); break; case kStateSentMgmtPendingDataset: - otLogInfoUtil(GetInstance(), "ChannelManager: Timed out waiting for change to %d, trying again.", mChannel); + otLogInfoUtil("ChannelManager: Timed out waiting for change to %d, trying again.", mChannel); mState = kStateChangeRequested; // fall through @@ -270,7 +268,7 @@ void ChannelManager::HandleStateChanged(otChangedFlags aFlags) mState = kStateIdle; StartAutoSelectTimer(); - otLogInfoUtil(GetInstance(), "ChannelManager: Channel successfully changed to %d", mChannel); + otLogInfoUtil("ChannelManager: Channel successfully changed to %d", mChannel); exit: return; @@ -325,8 +323,8 @@ otError ChannelManager::FindBetterChannel(uint8_t &aNewChannel, uint16_t &aOccup if (monitor.GetSampleCount() <= kMinChannelMonitorSampleCount) { - otLogInfoUtil(GetInstance(), "ChannelManager: Too few samples (%d <= %d) to select channel", - monitor.GetSampleCount(), kMinChannelMonitorSampleCount); + otLogInfoUtil("ChannelManager: Too few samples (%d <= %d) to select channel", monitor.GetSampleCount(), + kMinChannelMonitorSampleCount); ExitNow(error = OT_ERROR_INVALID_STATE); } @@ -336,10 +334,10 @@ otError ChannelManager::FindBetterChannel(uint8_t &aNewChannel, uint16_t &aOccup favoredBest = monitor.FindBestChannels(favoredAndSupported, favoredOccupancy); supportedBest = monitor.FindBestChannels(mSupportedChannelMask, supportedOccupancy); - otLogInfoUtil(GetInstance(), "ChannelManager: Best favored %s, occupancy 0x%04x", - favoredBest.ToString().AsCString(), favoredOccupancy); - otLogInfoUtil(GetInstance(), "ChannelManager: Best overall %s, occupancy 0x%04x", - supportedBest.ToString().AsCString(), supportedOccupancy); + otLogInfoUtil("ChannelManager: Best favored %s, occupancy 0x%04x", favoredBest.ToString().AsCString(), + favoredOccupancy); + otLogInfoUtil("ChannelManager: Best overall %s, occupancy 0x%04x", supportedBest.ToString().AsCString(), + supportedOccupancy); // Prefer favored channels unless there is no favored channel, // or the occupancy rate of the best favored channel is worse @@ -350,8 +348,7 @@ otError ChannelManager::FindBetterChannel(uint8_t &aNewChannel, uint16_t &aOccup { if (!favoredBest.IsEmpty()) { - otLogInfoUtil(GetInstance(), - "ChannelManager: Preferring an unfavored channel due to high occupancy rate diff"); + otLogInfoUtil("ChannelManager: Preferring an unfavored channel due to high occupancy rate diff"); } favoredBest = supportedBest; @@ -372,8 +369,8 @@ bool ChannelManager::ShouldAttamptChannelChange(void) uint16_t ccaFailureRate = GetInstance().Get().GetCcaFailureRate(); bool shouldAttempt = (ccaFailureRate >= kCcaFailureRateThreshold); - otLogInfoUtil(GetInstance(), "ChannelManager: CCA-err-rate: 0x%04x %s 0x%04x, selecting channel: %s", - ccaFailureRate, shouldAttempt ? ">=" : "<", kCcaFailureRateThreshold, shouldAttempt ? "yes" : "no"); + otLogInfoUtil("ChannelManager: CCA-err-rate: 0x%04x %s 0x%04x, selecting channel: %s", ccaFailureRate, + shouldAttempt ? ">=" : "<", kCcaFailureRateThreshold, shouldAttempt ? "yes" : "no"); return shouldAttempt; } @@ -384,7 +381,7 @@ otError ChannelManager::RequestChannelSelect(bool aSkipQualityCheck) uint8_t curChannel, newChannel; uint16_t curOccupancy, newOccupancy; - otLogInfoUtil(GetInstance(), "ChannelManager: Request to select channel (skip quality check: %s)", + otLogInfoUtil("ChannelManager: Request to select channel (skip quality check: %s)", aSkipQualityCheck ? "yes" : "no"); VerifyOrExit(GetInstance().Get().GetRole() != OT_DEVICE_ROLE_DISABLED, error = OT_ERROR_INVALID_STATE); @@ -398,12 +395,12 @@ otError ChannelManager::RequestChannelSelect(bool aSkipQualityCheck) if (newChannel == curChannel) { - otLogInfoUtil(GetInstance(), "ChannelManager: Already on best possible channel %d", curChannel); + otLogInfoUtil("ChannelManager: Already on best possible channel %d", curChannel); ExitNow(); } - otLogInfoUtil(GetInstance(), "ChannelManager: Cur channel %d, occupancy 0x%04x - Best channel %d, occupancy 0x%04x", - curChannel, curOccupancy, newChannel, newOccupancy); + otLogInfoUtil("ChannelManager: Cur channel %d, occupancy 0x%04x - Best channel %d, occupancy 0x%04x", curChannel, + curOccupancy, newChannel, newOccupancy); // Switch only if new channel's occupancy rate is better than current // channel's occupancy rate by threshold `kThresholdToChangeChannel`. @@ -411,7 +408,7 @@ otError ChannelManager::RequestChannelSelect(bool aSkipQualityCheck) if ((newOccupancy >= curOccupancy) || (static_cast(curOccupancy - newOccupancy) < kThresholdToChangeChannel)) { - otLogInfoUtil(GetInstance(), "ChannelManager: Occupancy rate diff too small to change channel"); + otLogInfoUtil("ChannelManager: Occupancy rate diff too small to change channel"); ExitNow(); } @@ -421,7 +418,7 @@ exit: if (error != OT_ERROR_NONE) { - otLogInfoUtil(GetInstance(), "ChannelManager: Request to select better channel failed, error: %s", + otLogInfoUtil("ChannelManager: Request to select better channel failed, error: %s", otThreadErrorToString(error)); } @@ -432,7 +429,7 @@ exit: otError ChannelManager::RequestChannelSelect(bool) { - otLogInfoUtil(GetInstance(), "ChannelManager: ChannelMonitor feature is disabled - cannot select channel"); + otLogInfoUtil("ChannelManager: ChannelMonitor feature is disabled - cannot select channel"); return OT_ERROR_DISABLED_FEATURE; } @@ -487,15 +484,14 @@ void ChannelManager::SetSupportedChannels(uint32_t aChannelMask) { mSupportedChannelMask.SetMask(aChannelMask & OT_RADIO_SUPPORTED_CHANNELS); - otLogInfoUtil(GetInstance(), "ChannelManager: Supported channels: %s", - mSupportedChannelMask.ToString().AsCString()); + otLogInfoUtil("ChannelManager: Supported channels: %s", mSupportedChannelMask.ToString().AsCString()); } void ChannelManager::SetFavoredChannels(uint32_t aChannelMask) { mFavoredChannelMask.SetMask(aChannelMask & OT_RADIO_SUPPORTED_CHANNELS); - otLogInfoUtil(GetInstance(), "ChannelManager: Favored channels: %s", mFavoredChannelMask.ToString().AsCString()); + otLogInfoUtil("ChannelManager: Favored channels: %s", mFavoredChannelMask.ToString().AsCString()); } } // namespace Utils diff --git a/src/core/utils/channel_monitor.cpp b/src/core/utils/channel_monitor.cpp index 856e92692..9a7431274 100644 --- a/src/core/utils/channel_monitor.cpp +++ b/src/core/utils/channel_monitor.cpp @@ -66,7 +66,7 @@ otError ChannelMonitor::Start(void) VerifyOrExit(!IsRunning(), error = OT_ERROR_ALREADY); Clear(); mTimer.Start(kTimerInterval); - otLogDebgUtil(GetInstance(), "ChannelMonitor: Starting"); + otLogDebgUtil("ChannelMonitor: Starting"); exit: return error; @@ -78,7 +78,7 @@ otError ChannelMonitor::Stop(void) VerifyOrExit(IsRunning(), error = OT_ERROR_ALREADY); mTimer.Stop(); - otLogDebgUtil(GetInstance(), "ChannelMonitor: Stopping"); + otLogDebgUtil("ChannelMonitor: Stopping"); exit: return error; @@ -90,7 +90,7 @@ void ChannelMonitor::Clear(void) mSampleCount = 0; memset(mChannelOccupancy, 0, sizeof(mChannelOccupancy)); - otLogDebgUtil(GetInstance(), "ChannelMonitor: Clearing data"); + otLogDebgUtil("ChannelMonitor: Clearing data"); } uint16_t ChannelMonitor::GetChannelOccupancy(uint8_t aChannel) const @@ -146,7 +146,7 @@ void ChannelMonitor::HandleEnergyScanResult(otEnergyScanResult *aResult) assert(channelIndex < kNumChannels); - otLogDebgUtil(GetInstance(), "ChannelMonitor: channel: %d, rssi:%d", aResult->mChannel, aResult->mMaxRssi); + otLogDebgUtil("ChannelMonitor: channel: %d, rssi:%d", aResult->mChannel, aResult->mMaxRssi); if (aResult->mMaxRssi != OT_RADIO_RSSI_INVALID) { @@ -182,7 +182,6 @@ void ChannelMonitor::HandleEnergyScanResult(otEnergyScanResult *aResult) void ChannelMonitor::LogResults(void) { otLogInfoUtil( - GetInstance(), "ChannelMonitor: %u [%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x]", mSampleCount, mChannelOccupancy[0] >> 8, mChannelOccupancy[1] >> 8, mChannelOccupancy[2] >> 8, mChannelOccupancy[3] >> 8, mChannelOccupancy[4] >> 8, mChannelOccupancy[5] >> 8, mChannelOccupancy[6] >> 8, diff --git a/src/core/utils/child_supervision.cpp b/src/core/utils/child_supervision.cpp index cb0bc057e..49d63e444 100644 --- a/src/core/utils/child_supervision.cpp +++ b/src/core/utils/child_supervision.cpp @@ -98,7 +98,7 @@ void ChildSupervisor::SendMessage(Child &aChild) SuccessOrExit(netif.SendMessage(*message)); message = NULL; - otLogInfoUtil(GetInstance(), "Sending supervision message to child 0x%04x", aChild.GetRloc16()); + otLogInfoUtil("Sending supervision message to child 0x%04x", aChild.GetRloc16()); exit: @@ -155,13 +155,13 @@ void ChildSupervisor::CheckState(void) if (shouldRun && !mTimer.IsRunning()) { mTimer.Start(kOneSecond); - otLogInfoUtil(GetInstance(), "Starting Child Supervision"); + otLogInfoUtil("Starting Child Supervision"); } if (!shouldRun && mTimer.IsRunning()) { mTimer.Stop(); - otLogInfoUtil(GetInstance(), "Stopping Child Supervision"); + otLogInfoUtil("Stopping Child Supervision"); } } @@ -249,7 +249,7 @@ void SupervisionListener::HandleTimer(void) VerifyOrExit((netif.GetMle().GetRole() == OT_DEVICE_ROLE_CHILD) && (netif.GetMeshForwarder().GetRxOnWhenIdle() == false)); - otLogWarnUtil(netif.GetInstance(), "Supervision timeout. No frame from parent in %d sec", mTimeout); + otLogWarnUtil("Supervision timeout. No frame from parent in %d sec", mTimeout); netif.GetMle().SendChildUpdateRequest(); diff --git a/src/core/utils/jam_detector.cpp b/src/core/utils/jam_detector.cpp index 2bb4a5736..3a6e8a8d2 100644 --- a/src/core/utils/jam_detector.cpp +++ b/src/core/utils/jam_detector.cpp @@ -75,7 +75,7 @@ otError JamDetector::Start(Handler aHandler, void *aContext) mContext = aContext; mEnabled = true; - otLogInfoUtil(GetInstance(), "JamDetector - Started"); + otLogInfoUtil("JamDetector - Started"); CheckState(); @@ -94,7 +94,7 @@ otError JamDetector::Stop(void) mTimer.Stop(); - otLogInfoUtil(GetInstance(), "JamDetector - Stopped"); + otLogInfoUtil("JamDetector - Stopped"); exit: return error; @@ -130,7 +130,7 @@ exit: otError JamDetector::SetRssiThreshold(int8_t aThreshold) { mRssiThreshold = aThreshold; - otLogInfoUtil(GetInstance(), "JamDetector - RSSI threshold set to %d", mRssiThreshold); + otLogInfoUtil("JamDetector - RSSI threshold set to %d", mRssiThreshold); return OT_ERROR_NONE; } @@ -143,7 +143,7 @@ otError JamDetector::SetWindow(uint8_t aWindow) VerifyOrExit(aWindow <= kMaxWindow, error = OT_ERROR_INVALID_ARGS); mWindow = aWindow; - otLogInfoUtil(GetInstance(), "JamDetector - window set to %d", mWindow); + otLogInfoUtil("JamDetector - window set to %d", mWindow); exit: return error; @@ -157,7 +157,7 @@ otError JamDetector::SetBusyPeriod(uint8_t aBusyPeriod) VerifyOrExit(aBusyPeriod <= mWindow, error = OT_ERROR_INVALID_ARGS); mBusyPeriod = aBusyPeriod; - otLogInfoUtil(GetInstance(), "JamDetector - busy period set to %d", mBusyPeriod); + otLogInfoUtil("JamDetector - busy period set to %d", mBusyPeriod); exit: return error; @@ -267,7 +267,7 @@ void JamDetector::SetJamState(bool aNewState) { mJamState = aNewState; shouldInvokeHandler = true; - otLogInfoUtil(GetInstance(), "JamDetector - jamming %s", mJamState ? "detected" : "cleared"); + otLogInfoUtil("JamDetector - jamming %s", mJamState ? "detected" : "cleared"); } if (shouldInvokeHandler) diff --git a/src/ncp/ncp_base.cpp b/src/ncp/ncp_base.cpp index daff866c7..c8a505d70 100644 --- a/src/ncp/ncp_base.cpp +++ b/src/ncp/ncp_base.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -2143,7 +2144,7 @@ template <> otError NcpBase::HandlePropertyGet( template <> otError NcpBase::HandlePropertyGet(void) { - return mEncoder.WriteUint8(ConvertLogLevel(otGetDynamicLogLevel(mInstance))); + return mEncoder.WriteUint8(ConvertLogLevel(otLoggingGetLevel())); } template <> otError NcpBase::HandlePropertySet(void) @@ -2187,7 +2188,7 @@ template <> otError NcpBase::HandlePropertySet( break; } - error = otSetDynamicLogLevel(mInstance, logLevel); + error = otLoggingSetLevel(logLevel); exit: return error; diff --git a/src/posix/platform/radio_spinel.cpp b/src/posix/platform/radio_spinel.cpp index 601314cb4..a4bd3f0c4 100644 --- a/src/posix/platform/radio_spinel.cpp +++ b/src/posix/platform/radio_spinel.cpp @@ -235,14 +235,13 @@ static otError SpinelStatusToOtError(spinel_status_t aError) return ret; } -static void LogIfFail(otInstance *aInstance, const char *aText, otError aError) +static void LogIfFail(const char *aText, otError aError) { if (aError != OT_ERROR_NONE) { - otLogWarnPlat(aInstance, "%s: %s", aText, otThreadErrorToString(aError)); + otLogWarnPlat("%s: %s", aText, otThreadErrorToString(aError)); } - OT_UNUSED_VARIABLE(aInstance); OT_UNUSED_VARIABLE(aText); OT_UNUSED_VARIABLE(aError); } @@ -284,7 +283,7 @@ static int ForkPty(const char *aCommand, const char *aArguments) rval = snprintf(cmd, sizeof(cmd), "exec %s %s", aCommand, aArguments); VerifyOrExit(rval > 0 && static_cast(rval) < sizeof(cmd), - otLogCritPlat(mInstance, "NCP file and configuration is too long!")); + otLogCritPlat("NCP file and configuration is too long!")); execl(getenv("SHELL"), getenv("SHELL"), "-c", cmd, NULL); perror("open pty failed"); @@ -561,9 +560,8 @@ void RadioSpinel::Init(const char *aRadioFile, const char *aRadioConfig) if ((versionMajor != SPINEL_PROTOCOL_VERSION_THREAD_MAJOR) || (versionMinor != SPINEL_PROTOCOL_VERSION_THREAD_MINOR)) { - otLogCritPlat(mInstance, "Spinel version mismatch - PosixApp:%d.%d, RCP:%d.%d", - SPINEL_PROTOCOL_VERSION_THREAD_MAJOR, SPINEL_PROTOCOL_VERSION_THREAD_MINOR, versionMajor, - versionMinor); + otLogCritPlat("Spinel version mismatch - PosixApp:%d.%d, RCP:%d.%d", SPINEL_PROTOCOL_VERSION_THREAD_MAJOR, + SPINEL_PROTOCOL_VERSION_THREAD_MINOR, versionMajor, versionMinor); exit(OT_EXIT_INCOMPATIBLE_RADIO_SPINEL); } } @@ -621,13 +619,12 @@ void RadioSpinel::HandleSpinelFrame(const uint8_t *aBuffer, uint16_t aLength) } exit: - LogIfFail(mInstance, "Error handling hdlc frame", error); + LogIfFail("Error handling hdlc frame", error); } void RadioSpinel::HandleHdlcError(void *aContext, otError aError, uint8_t *aBuffer, uint16_t aLength) { - otLogWarnPlat(static_cast(aContext)->mInstance, "Error decoding hdlc frame: %s", - otThreadErrorToString(aError)); + otLogWarnPlat("Error decoding hdlc frame: %s", otThreadErrorToString(aError)); OT_UNUSED_VARIABLE(aContext); OT_UNUSED_VARIABLE(aError); OT_UNUSED_VARIABLE(aBuffer); @@ -667,7 +664,7 @@ void RadioSpinel::HandleNotification(const uint8_t *aBuffer, uint16_t aLength) case SPINEL_CMD_PROP_VALUE_INSERTED: case SPINEL_CMD_PROP_VALUE_REMOVED: - otLogInfoPlat(mInstance, "Ignored command %d", cmd); + otLogInfoPlat("Ignored command %d", cmd); break; default: @@ -675,7 +672,7 @@ void RadioSpinel::HandleNotification(const uint8_t *aBuffer, uint16_t aLength) } exit: - LogIfFail(mInstance, "Error processing notification", error); + LogIfFail("Error processing notification", error); } void RadioSpinel::HandleResponse(const uint8_t *aBuffer, uint16_t aLength) @@ -706,12 +703,12 @@ void RadioSpinel::HandleResponse(const uint8_t *aBuffer, uint16_t aLength) } else { - otLogWarnPlat(mInstance, "Unexpected Spinel transaction message: %u", SPINEL_HEADER_GET_TID(header)); + otLogWarnPlat("Unexpected Spinel transaction message: %u", SPINEL_HEADER_GET_TID(header)); error = OT_ERROR_DROP; } exit: - LogIfFail(mInstance, "Error processing response", error); + LogIfFail("Error processing response", error); } void RadioSpinel::HandleWaitingResponse(uint32_t aCommand, @@ -766,7 +763,7 @@ void RadioSpinel::HandleWaitingResponse(uint32_t aCommand, } exit: - LogIfFail(mInstance, "Error processing result", mError); + LogIfFail("Error processing result", mError); } void RadioSpinel::HandleValueIs(spinel_prop_key_t aKey, const uint8_t *aBuffer, uint16_t aLength) @@ -788,7 +785,7 @@ void RadioSpinel::HandleValueIs(spinel_prop_key_t aKey, const uint8_t *aBuffer, if (status >= SPINEL_STATUS_RESET__BEGIN && status <= SPINEL_STATUS_RESET__END) { - otLogCritPlat(mInstance, "RCP reset: %s", spinel_status_to_cstr(status)); + otLogCritPlat("RCP reset: %s", spinel_status_to_cstr(status)); mIsReady = true; // If RCP crashes/resets while radio was enabled, posix app exits. @@ -796,7 +793,7 @@ void RadioSpinel::HandleValueIs(spinel_prop_key_t aKey, const uint8_t *aBuffer, } else { - otLogInfoPlat(mInstance, "RCP last status: %s", spinel_status_to_cstr(status)); + otLogInfoPlat("RCP last status: %s", spinel_status_to_cstr(status)); } } else if (aKey == SPINEL_PROP_MAC_ENERGY_SCAN_RESULT) @@ -820,11 +817,11 @@ void RadioSpinel::HandleValueIs(spinel_prop_key_t aKey, const uint8_t *aBuffer, assert(len < sizeof(logStream)); VerifyOrExit(unpacked > 0, error = OT_ERROR_PARSE); logStream[len] = '\0'; - otLogDebgPlat(mInstance, "RCP DEBUG INFO: %s", logStream); + otLogDebgPlat("RCP DEBUG INFO: %s", logStream); } exit: - LogIfFail(mInstance, "Failed to handle ValueIs", error); + LogIfFail("Failed to handle ValueIs", error); } otError RadioSpinel::ParseRadioFrame(otRadioFrame &aFrame, const uint8_t *aBuffer, uint16_t aLength) @@ -852,7 +849,7 @@ otError RadioSpinel::ParseRadioFrame(otRadioFrame &aFrame, const uint8_t *aBuffe VerifyOrExit(unpacked > 0, error = OT_ERROR_PARSE); exit: - LogIfFail(mInstance, "Handle radio frame failed", error); + LogIfFail("Handle radio frame failed", error); return error; } @@ -1104,7 +1101,7 @@ otError RadioSpinel::GetTransmitPower(int8_t &aPower) { otError error = Get(SPINEL_PROP_PHY_TX_POWER, SPINEL_DATATYPE_INT8_S, &aPower); - LogIfFail(mInstance, "Get transmit power failed", error); + LogIfFail("Get transmit power failed", error); return error; } @@ -1113,14 +1110,14 @@ int8_t RadioSpinel::GetRssi(void) int8_t rssi = OT_RADIO_RSSI_INVALID; otError error = Get(SPINEL_PROP_PHY_RSSI, SPINEL_DATATYPE_INT8_S, &rssi); - LogIfFail(mInstance, "Get RSSI failed", error); + LogIfFail("Get RSSI failed", error); return rssi; } otError RadioSpinel::SetTransmitPower(int8_t aPower) { otError error = Set(SPINEL_PROP_PHY_TX_POWER, SPINEL_DATATYPE_INT8_S, aPower); - LogIfFail(mInstance, "Set transmit power failed", error); + LogIfFail("Set transmit power failed", error); return error; } @@ -1286,7 +1283,7 @@ otError RadioSpinel::WaitResponse(void) } while (mWaitingTid || !mIsReady); exit: - LogIfFail(mInstance, "Error waiting response", mError); + LogIfFail("Error waiting response", mError); // This indicates end of waiting repsonse. mWaitingKey = SPINEL_PROP_LAST_STATUS; return mError; @@ -1526,14 +1523,14 @@ void RadioSpinel::HandleTransmitDone(uint32_t aCommand, } else { - otLogWarnPlat(mInstance, "Spinel status: %d.", status); + otLogWarnPlat("Spinel status: %d.", status); error = SpinelStatusToOtError(status); } exit: mTxState = kDone; mTxError = error; - LogIfFail(mInstance, "Handle transmit done failed", error); + LogIfFail("Handle transmit done failed", error); } otError RadioSpinel::Transmit(otRadioFrame &aFrame)