8000 Changes to follow arduino logging rules · prajesh-pixel/esp32-snippets@e9576ee · GitHub
[go: up one dir, main page]

Skip to content

Commit e9576ee

Browse files
committed
Changes to follow arduino logging rules
1 parent 45fcc07 commit e9576ee

18 files changed

+104
-53
lines changed

cpp_utils/BLEAdvertisedDevice.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@
1313
*/
1414
#include "sdkconfig.h"
1515
#if defined(CONFIG_BT_ENABLED)
16-
#include <esp_log.h>
1716
#include <sstream>
1817
#include "BLEAdvertisedDevice.h"
1918
#include "BLEUtils.h"
20-
#ifdef ARDUINO_ARCH_ESP32
19+
#if defined(ARDUINO_ARCH_ESP32) && defined(CONFIG_ARDUHAL_ESP_LOG)
2120
#include "esp32-hal-log.h"
22-
#endif
21+
#define LOG_TAG ""
22+
#else
23+
#include "esp_log.h"
2324
static const char* LOG_TAG="BLEAdvertisedDevice";
25+
#endif
2426

2527
BLEAdvertisedDevice::BLEAdvertisedDevice() {
2628
m_adFlag = 0;

cpp_utils/BLEAdvertising.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,18 @@
1919
#include "sdkconfig.h"
2020
#if defined(CONFIG_BT_ENABLED)
2121
#include "BLEAdvertising.h"
22-
#include <esp_log.h>
2322
#include <esp_err.h>
2423
#include "BLEUtils.h"
2524
#include "GeneralUtils.h"
2625

27-
#ifdef ARDUINO_ARCH_ESP32
26+
#if defined(ARDUINO_ARCH_ESP32) && defined(CONFIG_ARDUHAL_ESP_LOG)
2827
#include "esp32-hal-log.h"
28+
#define LOG_TAG ""
29+
#else
30+
#include "esp_log.h"
31+
static const char* LOG_TAG = "BLEAdvertising";
2932
#endif
3033

31-
static const char* LOG_TAG = "BLEAdvertising";
3234

3335

3436
/**

cpp_utils/BLEBeacon.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,17 @@
77
#include "sdkconfig.h"
88
#if defined(CONFIG_BT_ENABLED)
99
#include <string.h>
10-
#include <esp_log.h>
1110
#include "BLEBeacon.h"
11+
#if defined(ARDUINO_ARCH_ESP32) && defined(CONFIG_ARDUHAL_ESP_LOG)
12+
#include "esp32-hal-log.h"
13+
#define LOG_TAG ""
14+
#else
15+
#include "esp_log.h"
16+
static const char* LOG_TAG = "BLEBeacon";
17+
#endif
1218

1319
#define ENDIAN_CHANGE_U16(x) ((((x)&0xFF00)>>8) + (((x)&0xFF)<<8))
1420

15-
static const char LOG_TAG[] = "BLEBeacon";
1621

1722
BLEBeacon::BLEBeacon() {
1823
m_beaconData.manufacturerId = 0x4c00;

cpp_utils/BLECharacteristic.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,20 @@
1111
#include <iomanip>
1212
#include <stdlib.h>
1313
#include "sdkconfig.h"
14-
#include <esp_log.h>
1514
#include <esp_err.h>
1615
#include "BLECharacteristic.h"
1716
#include "BLEService.h"
1817
#include "BLEDevice.h"
1918
#include "BLEUtils.h"
2019
#include "BLE2902.h"
2120
#include "GeneralUtils.h"
22-
#ifdef ARDUINO_ARCH_ESP32
21+
#if defined(ARDUINO_ARCH_ESP32) && defined(CONFIG_ARDUHAL_ESP_LOG)
2322
#include "esp32-hal-log.h"
24-
#endif
25-
23+
#define LOG_TAG ""
24+
#else
25+
#include "esp_log.h"
2626
static const char* LOG_TAG = "BLECharacteristic";
27+
#endif
2728

2829
#define NULL_HANDLE (0xffff)
2930

cpp_utils/BLEClient.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
*/
77
#include "sdkconfig.h"
88
#if defined(CONFIG_BT_ENABLED)
9-
#include <esp_log.h>
109
#include <esp_bt.h>
1110
#include <esp_bt_main.h>
1211
#include <esp_gap_ble_api.h>
@@ -19,10 +18,15 @@
1918
#include <sstream>
2019
#include <unordered_set>
2120
#include "BLEDevice.h"
22-
#ifdef ARDUINO_ARCH_ESP32
21+
#if defined(ARDUINO_ARCH_ESP32) && defined(CONFIG_ARDUHAL_ESP_LOG)
2322
#include "esp32-hal-log.h"
23+
#define LOG_TAG ""
24+
#else
25+
#include "esp_log.h"
26+
static const char* LOG_TAG = "BLEClient";
2427
#endif
2528

29+
2630
/*
2731
* Design
2832
* ------
@@ -43,7 +47,6 @@
4347
*
4448
*
4549
*/
46-
static const char* LOG_TAG = "BLEClient";
4750

4851
BLEClient::BLEClient() {
4952
m_pClientCallbacks = nullptr;

cpp_utils/BLEDescriptor.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,19 @@
1111
#include <iomanip>
1212
#include <stdlib.h>
1313
#include "sdkconfig.h"
14-
#include <esp_log.h>
1514
#include <esp_err.h>
1615
#include "BLEService.h"
1716
#include "BLEDescriptor.h"
1817
#include "GeneralUtils.h"
19-
#ifdef ARDUINO_ARCH_ESP32
18+
#if defined(ARDUINO_ARCH_ESP32) && defined(CONFIG_ARDUHAL_ESP_LOG)
2019
#include "esp32-hal-log.h"
20+
#define LOG_TAG ""
21+
#else
22+
#include "esp_log.h"
23+
static const char* LOG_TAG = "BLEDescriptor";
2124
#endif
2225

23-
static const char* LOG_TAG = "BLEDescriptor";
26+
2427

2528

2629
#define NULL_HANDLE (0xffff)

cpp_utils/BLEDevice.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include <esp_gattc_api.h> // ESP32 BLE
2020
#include <esp_gatt_common_api.h>// ESP32 BLE
2121
#include <esp_err.h> // ESP32 ESP-IDF
22-
#include <esp_log.h> // ESP32 ESP-IDF
2322
#include <map> // Part of C++ Standard library
2423
#include <sstream> // Part of C++ Standard library
2524
#include <iomanip> // Part of C++ Standard library
@@ -28,12 +27,15 @@
2827
#include "BLEClient.h"
2928
#include "BLEUtils.h"
3029
#include "GeneralUtils.h"
31-
#ifdef ARDUINO_ARCH_ESP32
30+
#if defined(ARDUINO_ARCH_ESP32) && defined(CONFIG_ARDUHAL_ESP_LOG)
3231
#include "esp32-hal-log.h"
3332
#include "esp32-hal-bt.h"
33+
#define LOG_TAG ""
34+
#else
35+
#include "esp_log.h"
36+
static const char* LOG_TAG = "BLEDevice";
3437
#endif
3538

36-
static const char* LOG_TAG = "BLEDevice";
3739

3840
/**
3941
* Singletons for the BLEDevice.

cpp_utils/BLERemoteCharacteristic.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,22 @@
1111
#if defined(CONFIG_BT_ENABLED)
1212

1313
#include <esp_gattc_api.h>
14-
#include <esp_log.h>
1514
#include <esp_err.h>
1615

1716
#include <sstream>
1817
#include "BLEExceptions.h"
1918
#include "BLEUtils.h"
2019
#include "GeneralUtils.h"
2120
#include "BLERemoteDescriptor.h"
22-
#ifdef ARDUINO_ARCH_ESP32
21+
#if defined(ARDUINO_ARCH_ESP32) && defined(CONFIG_ARDUHAL_ESP_LOG)
2322
#include "esp32-hal-log.h"
23+
#define LOG_TAG ""
24+
#else
25+
#include "esp_log.h"
26+
static const char* LOG_TAG = "BLERemoteCharacteristic"; // The logging tag for this class.
2427
#endif
2528

2629

27-
static const char* LOG_TAG = "BLERemoteCharacteristic"; // The logging tag for this class.
2830

2931
/**
3032
* @brief Constructor.

cpp_utils/BLERemoteDescriptor.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,15 @@
99
#include <sstream>
1010
#include "BLERemoteDescriptor.h"
1111
#include "GeneralUtils.h"
12-
#include <esp_log.h>
13-
#ifdef ARDUINO_ARCH_ESP32
12+
#if defined(ARDUINO_ARCH_ESP32) && defined(CONFIG_ARDUHAL_ESP_LOG)
1413
#include "esp32-hal-log.h"
14+
#define LOG_TAG ""
15+
#else
16+
#include "esp_log.h"
17+
static const char* LOG_TAG = "BLERemoteDescriptor";
1518
#endif
1619

17-
static const char* LOG_TAG = "BLERemoteDescriptor";
20+
1821

1922

2023
BLERemoteDescriptor::BLERemoteDescriptor(

cpp_utils/BLERemoteService.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,16 @@
1111
#include "BLERemoteService.h"
1212
#include "BLEUtils.h"
1313
#include "GeneralUtils.h"
14-
#include <esp_log.h>
1514
#include <esp_err.h>
16-
#ifdef ARDUINO_ARCH_ESP32
15+
#if defined(ARDUINO_ARCH_ESP32) && defined(CONFIG_ARDUHAL_ESP_LOG)
1716
#include "esp32-hal-log.h"
17+
#define LOG_TAG ""
18+
#else
19+
#include "esp_log.h"
20+
static const char* LOG_TAG = "BLERemoteService";
1821
#endif
1922

20-
static const char* LOG_TAG = "BLERemoteService";
23+
2124

2225
BLERemoteService::BLERemoteService(
2326
esp_gatt_id_t srvcId,

cpp_utils/BLEScan.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#if defined(CONFIG_BT_ENABLED)
99

1010

11-
#include <esp_log.h>
1211
#include <esp_err.h>
1312

1413
#include <map>
@@ -17,11 +16,15 @@
1716
#include "BLEScan.h"
1817
#include "BLEUtils.h"
1918
#include "GeneralUtils.h"
20-
#ifdef ARDUINO_ARCH_ESP32
19+
#if defined(ARDUINO_ARCH_ESP32) && defined(CONFIG_ARDUHAL_ESP_LOG)
2120
#include "esp32-hal-log.h"
21+
#define LOG_TAG ""
22+
#else
23+
#include "esp_log.h"
24+
static const char* LOG_TAG = "BLEScan";
2225
#endif
2326

24-
static const char* LOG_TAG = "BLEScan";
27+
2528

2629

2730
/**

cpp_utils/BLEServer.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
#include "sdkconfig.h"
99
#if defined(CONFIG_BT_ENABLED)
10-
#include <esp_log.h>
1110
#include <esp_bt.h>
1211
#include <esp_bt_main.h>
1312
#include "GeneralUtils.h"
@@ -18,11 +17,15 @@
1817
#include <string.h>
1918
#include <string>
2019
#include <unordered_set>
21-
#ifdef ARDUINO_ARCH_ESP32
20+
#if defined(ARDUINO_ARCH_ESP32) && defined(CONFIG_ARDUHAL_ESP_LOG)
2221
#include "esp32-hal-log.h"
22+
#define LOG_TAG ""
23+
#else
24+
#include "esp_log.h"
25+
static const char* LOG_TAG = "BLEServer";
2326
#endif
2427

25-
static const char* LOG_TAG = "BLEServer";
28+
2629

2730

2831
/**

cpp_utils/BLEService.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#if defined(CONFIG_BT_ENABLED)
1212
#include <esp_err.h>
1313
#include <esp_gatts_api.h>
14-
#include <esp_log.h>
1514

1615
#include <iomanip>
1716
#include <sstream>
@@ -22,13 +21,16 @@
2221
#include "BLEUtils.h"
2322
#include "GeneralUtils.h"
2423

25-
#ifdef ARDUINO_ARCH_ESP32
24+
#if defined(ARDUINO_ARCH_ESP32) && defined(CONFIG_ARDUHAL_ESP_LOG)
2625
#include "esp32-hal-log.h"
26+
#define LOG_TAG ""
27+
#else
28+
#include "esp_log.h"
29+
static const char* LOG_TAG = "BLEService"; // Tag for logging.
2730
#endif
2831

2932
#define NULL_HANDLE (0xffff)
3033

31-
static const char* LOG_TAG = "BLEService"; // Tag for logging.
3234

3335
/**
3436
* @brief Construct an instance of the BLEService

cpp_utils/BLEUUID.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,23 @@
66
*/
77
#include "sdkconfig.h"
88
#if defined(CONFIG_BT_ENABLED)
9-
#include <esp_log.h>
109
#include <string.h>
1110
#include <sstream>
1211
#include <iomanip>
1312
#include <stdio.h>
1413
#include <assert.h>
1514
#include <stdlib.h>
1615
#include "BLEUUID.h"
17-
static const char* LOG_TAG = "BLEUUID";
1816

19-
#ifdef ARDUINO_ARCH_ESP32
17+
#if defined(ARDUINO_ARCH_ESP32) && defined(CONFIG_ARDUHAL_ESP_LOG)
2018
#include "esp32-hal-log.h"
19+
#define LOG_TAG ""
20+
#else
21+
#include "esp_log.h"
22+
static const char* LOG_TAG = "BLEUUID";
2123
#endif
2224

25+
2326
/**
2427
* @brief Copy memory from source to target but in reverse order.
2528
*

cpp_utils/BLEUtils.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,18 @@
1919
#include <esp_gap_ble_api.h> // ESP32 BLE
2020
#include <esp_gattc_api.h> // ESP32 BLE
2121
#include <esp_err.h> // ESP32 ESP-IDF
22-
#include <esp_log.h> // ESP32 ESP-IDF
2322
#include <map> // Part of C++ STL
2423
#include <sstream>
2524
#include <iomanip>
2625

27-
#ifdef ARDUINO_ARCH_ESP32
26+
#if defined(ARDUINO_ARCH_ESP32) && defined(CONFIG_ARDUHAL_ESP_LOG)
2827
#include "esp32-hal-log.h"
28+
#define LOG_TAG ""
29+
#else
30+
#include "esp_log.h"
31+
static const char* LOG_TAG = "BLEUtils"; // Tag for logging.
2932
#endif
3033

31-
static const char* LOG_TAG = "BLEUtils"; // Tag for logging.
3234

3335
/*
3436
static std::map<std::string, BLEClient*> g_addressMap;

cpp_utils/BLEValue.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@
77
#include "sdkconfig.h"
88
#if defined(CONFIG_BT_ENABLED)
99

10-
#include <esp_log.h>
11-
12-
#include "BLEValue.h"
13-
#ifdef ARDUINO_ARCH_ESP32
10+
#if defined(ARDUINO_ARCH_ESP32) && defined(CONFIG_ARDUHAL_ESP_LOG)
1411
#include "esp32-hal-log.h"
12+
#define LOG_TAG ""
13+
#else
14+
#include "esp_log.h"
15+
static const char* LOG_TAG="BLEValue";
1516
#endif
1617

17-
static const char* LOG_TAG="BLEValue";
18+
1819

1920
BLEValue::BLEValue() {
2021
m_accumulation = "";

0 commit comments

Comments
 (0)
0