Skip to content

Commit 49edd64

Browse files
committed
Update NimBLELog
1 parent badbef3 commit 49edd64

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/NimBLELog.h

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,19 @@
77
*/
88
#ifndef MAIN_NIMBLELOG_H_
99
#define MAIN_NIMBLELOG_H_
10+
1011
#include "sdkconfig.h"
12+
1113
#if defined(CONFIG_BT_ENABLED)
1214

15+
#ifdef ARDUINO_ARCH_ESP32
1316
#include "syscfg/syscfg.h"
1417
#include "modlog/modlog.h"
1518

16-
1719
// If Arduino is being used, strip out the colors and ignore log printing below ui setting.
1820
// Note: because CONFIG_LOG_DEFAULT_LEVEL is set at ERROR in Arduino we must use MODLOG_DFLT(ERROR
1921
// otherwise no messages will be printed above that level.
20-
#ifdef ARDUINO_ARCH_ESP32
22+
2123
#ifndef CORE_DEBUG_LEVEL
2224
#define CORE_DEBUG_LEVEL CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL
2325
#endif
@@ -49,11 +51,15 @@
4951
#define NIMBLE_LOGC( tag, format, ... ) MODLOG_DFLT(CRITICAL, "CRIT %s: "#format"\n",tag,##__VA_ARGS__)
5052

5153
#else
52-
#define NIMBLE_LOGE( tag, format, ... ) MODLOG_DFLT(ERROR, "\033[0;31mE %s: "#format"\033[0m\n",tag,##__VA_ARGS__)
53-
#define NIMBLE_LOGW( tag, format, ... ) MODLOG_DFLT(WARN, "\033[0;33mW %s: "#format"\033[0m\n",tag,##__VA_ARGS__)
54-
#define NIMBLE_LOGI( tag, format, ... ) MODLOG_DFLT(INFO, "\033[0;32mI %s: "#format"\033[0m\n",tag,##__VA_ARGS__)
55-
#define NIMBLE_LOGD( tag, format, ... ) MODLOG_DFLT(DEBUG, "D %s: "#format"\n",tag,##__VA_ARGS__)
56-
#define NIMBLE_LOGC( tag, format, ... ) MODLOG_DFLT(CRITICAL, "\033[1;31mCRIT %s: "#format"\033[0m\n",tag,##__VA_ARGS__)
54+
55+
#include "esp_log.h"
56+
57+
#define NIMBLE_LOGE(tag, format, ...) ESP_LOGE(tag, format, ##__VA_ARGS__)
58+
#define NIMBLE_LOGW(tag, format, ...) ESP_LOGW(tag, format, ##__VA_ARGS__)
59+
#define NIMBLE_LOGI(tag, format, ...) ESP_LOGI(tag, format, ##__VA_ARGS__)
60+
#define NIMBLE_LOGD(tag, format, ...) ESP_LOGD(tag, format, ##__VA_ARGS__)
61+
#define NIMBLE_LOGC(tag, format, ...) ESP_LOGE(tag, format, ##__VA_ARGS__)
62+
5763
#endif /*ARDUINO_ARCH_ESP32*/
5864

5965
#endif /*CONFIG_BT_ENABLED*/

0 commit comments

Comments
 (0)