|
7 | 7 | */ |
8 | 8 | #ifndef MAIN_NIMBLELOG_H_ |
9 | 9 | #define MAIN_NIMBLELOG_H_ |
| 10 | + |
10 | 11 | #include "sdkconfig.h" |
| 12 | + |
11 | 13 | #if defined(CONFIG_BT_ENABLED) |
12 | 14 |
|
| 15 | +#ifdef ARDUINO_ARCH_ESP32 |
13 | 16 | #include "syscfg/syscfg.h" |
14 | 17 | #include "modlog/modlog.h" |
15 | 18 |
|
16 | | - |
17 | 19 | // If Arduino is being used, strip out the colors and ignore log printing below ui setting. |
18 | 20 | // Note: because CONFIG_LOG_DEFAULT_LEVEL is set at ERROR in Arduino we must use MODLOG_DFLT(ERROR |
19 | 21 | // otherwise no messages will be printed above that level. |
20 | | -#ifdef ARDUINO_ARCH_ESP32 |
| 22 | + |
21 | 23 | #ifndef CORE_DEBUG_LEVEL |
22 | 24 | #define CORE_DEBUG_LEVEL CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL |
23 | 25 | #endif |
|
49 | 51 | #define NIMBLE_LOGC( tag, format, ... ) MODLOG_DFLT(CRITICAL, "CRIT %s: "#format"\n",tag,##__VA_ARGS__) |
50 | 52 |
|
51 | 53 | #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 | + |
57 | 63 | #endif /*ARDUINO_ARCH_ESP32*/ |
58 | 64 |
|
59 | 65 | #endif /*CONFIG_BT_ENABLED*/ |
|
0 commit comments