Update log level macro name

This commit is contained in:
h2zero 2022-01-14 09:58:37 -07:00
parent fac16f2428
commit 9824bdfe73
4 changed files with 15 additions and 9 deletions

View file

@ -520,7 +520,7 @@ NimBLECharacteristicCallbacks* NimBLECharacteristic::getCallbacks() {
* @param [in] length The length of the data in bytes.
*/
void NimBLECharacteristic::setValue(const uint8_t* data, size_t length) {
#if CONFIG_LOG_DEFAULT_LEVEL > 3 || (ARDUINO_ARCH_ESP32 && CORE_DEBUG_LEVEL >= 4)
#if CONFIG_NIMBLE_CPP_DEBUG_LEVEL >= 4
char* pHex = NimBLEUtils::buildHexData(nullptr, data, length);
NIMBLE_LOGD(LOG_TAG, ">> setValue: length=%d, data=%s, characteristic UUID=%s", length, pHex, getUUID().toString().c_str());
free(pHex);

View file

@ -31,33 +31,33 @@
// Note: because CONFIG_LOG_DEFAULT_LEVEL is set at ERROR in Arduino we must use MODLOG_DFLT(ERROR
// otherwise no messages will be printed above that level.
#ifndef NIMBLE_CPP_DEBUG_LEVEL
#ifndef CONFIG_NIMBLE_CPP_DEBUG_LEVEL
#if defined(ARDUINO_ARCH_ESP32) && defined(CORE_DEBUG_LEVEL)
#define NIMBLE_CPP_DEBUG_LEVEL CORE_DEBUG_LEVEL
#define CONFIG_NIMBLE_CPP_DEBUG_LEVEL CORE_DEBUG_LEVEL
#else
#define NIMBLE_CPP_DEBUG_LEVEL 0
#define CONFIG_NIMBLE_CPP_DEBUG_LEVEL 0
#endif
#endif
#if NIMBLE_CPP_DEBUG_LEVEL >= 4
#if CONFIG_NIMBLE_CPP_DEBUG_LEVEL >= 4
#define NIMBLE_LOGD( tag, format, ... ) console_printf("D %s: "#format"\n",tag,##__VA_ARGS__)
#else
#define NIMBLE_LOGD( tag, format, ... ) (void)tag
#endif
#if NIMBLE_CPP_DEBUG_LEVEL >= 3
#if CONFIG_NIMBLE_CPP_DEBUG_LEVEL >= 3
#define NIMBLE_LOGI( tag, format, ... ) console_printf("I %s: "#format"\n",tag,##__VA_ARGS__)
#else
#define NIMBLE_LOGI( tag, format, ... ) (void)tag
#endif
#if NIMBLE_CPP_DEBUG_LEVEL >= 2
#if CONFIG_NIMBLE_CPP_DEBUG_LEVEL >= 2
#define NIMBLE_LOGW( tag, format, ... ) console_printf("W %s: "#format"\n",tag,##__VA_ARGS__)
#else
#define NIMBLE_LOGW( tag, format, ... ) (void)tag
#endif
#if NIMBLE_CPP_DEBUG_LEVEL >= 1
#if CONFIG_NIMBLE_CPP_DEBUG_LEVEL >= 1
#define NIMBLE_LOGE( tag, format, ... ) console_printf("E %s: "#format"\n",tag,##__VA_ARGS__)
#define NIMBLE_LOGC( tag, format, ... ) console_printf("CRIT %s: "#format"\n",tag,##__VA_ARGS__)
#else

View file

@ -181,7 +181,7 @@ void NimBLEServer::start() {
abort();
}
#if CONFIG_LOG_DEFAULT_LEVEL > 3 || (ARDUINO_ARCH_ESP32 && CORE_DEBUG_LEVEL >= 4)
#if CONFIG_NIMBLE_CPP_DEBUG_LEVEL >= 4
ble_gatts_show_local();
#endif
/*** Future use ***

View file

@ -44,6 +44,12 @@
*/
#define CONFIG_BT_NIMBLE_LOG_LEVEL 5
/** @brief Un-comment to set the debug log messages level from the NimBLE CPP Wrapper.\n
* Values: 0 = NONE, 1 = ERROR, 2 = WARNING, 3 = INFO, 4+ = DEBUG\n
* Uses approx. 32kB of flash memory.
*/
#define CONFIG_NIMBLE_CPP_DEBUG_LEVEL 0
/** @brief Un-comment to see NimBLE host return codes as text debug log messages.
* Uses approx. 7kB of flash memory.
*/