Refactored use of LOG_X(LOG_TAG, ...) to log_x(...) (#2672)

* Replaced ARDUINO_VARIANT with const char

* Fixed missing return value

* Added quotes around defined value in macro (Issue #2193)

* Change logging from Error to Verbose when not found and default available

* Move Enter and Exit logging to Verbose Level

* Refactored LOG_X() into log_x()
This commit is contained in:
Bascy
2019-04-15 17:26:35 +02:00
committed by Me No Dev
parent af23d0bb10
commit 01d7ea7b80
21 changed files with 399 additions and 530 deletions

View File

@ -7,16 +7,7 @@
#include "sdkconfig.h"
#if defined(CONFIG_BT_ENABLED)
#include "BLEValue.h"
#if defined(ARDUINO_ARCH_ESP32) && defined(CONFIG_ARDUHAL_ESP_LOG)
#include "esp32-hal-log.h"
#define LOG_TAG ""
#else
#include "esp_log.h"
static const char* LOG_TAG="BLEValue";
#endif
BLEValue::BLEValue() {
m_accumulation = "";
@ -31,7 +22,7 @@ BLEValue::BLEValue() {
* @param [in] part A message part being added.
*/
void BLEValue::addPart(std::string part) {
ESP_LOGD(LOG_TAG, ">> addPart: length=%d", part.length());
log_v(">> addPart: length=%d", part.length());
m_accumulation += part;
} // addPart
@ -43,7 +34,7 @@ void BLEValue::addPart(std::string part) {
* @param [in] length The number of bytes being added.
*/
void BLEValue::addPart(uint8_t* pData, size_t length) {
ESP_LOGD(LOG_TAG, ">> addPart: length=%d", length);
log_v(">> addPart: length=%d", length);
m_accumulation += std::string((char*) pData, length);
} // addPart
@ -52,7 +43,7 @@ void BLEValue::addPart(uint8_t* pData, size_t length) {
* @brief Cancel the current accumulation.
*/
void BLEValue::cancel() {
ESP_LOGD(LOG_TAG, ">> cancel");
log_v(">> cancel");
m_accumulation = "";
m_readOffset = 0;
} // cancel
@ -65,7 +56,7 @@ void BLEValue::cancel() {
* we now have the complete message and commit the change as a unit.
*/
void BLEValue::commit() {
ESP_LOGD(LOG_TAG, ">> commit");
log_v(">> commit");
// If there is nothing to commit, do nothing.
if (m_accumulation.length() == 0) return;
setValue(m_accumulation);