Skip to content

Commit

Permalink
Include ESP_LOGE, ESP_LOGD and ESP_LOGV definitions for esp8266 logging
Browse files Browse the repository at this point in the history
  • Loading branch information
paclema committed May 19, 2023
1 parent 76a4915 commit 4881214
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ HEAD

* Bump MQTTClient on examples to v0.2.0
* Removed unnecessary break line in log message
* Include ESP_LOGE, ESP_LOGD and ESP_LOGV definitions for esp8266 logging

v0.2.0 (2023-05-16)
------
Expand Down
19 changes: 17 additions & 2 deletions src/ESP8266Log.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,28 @@
#define ESP8266LOG_H

#ifdef ESP8266
#define ESP_LOGE(TAG, ...) do { \
Serial.printf("[%6lu][E][%s]: ", (unsigned long) (micros() / 1000ULL), TAG); \
Serial.printf(__VA_ARGS__); \
Serial.println(); \
} while (0)
#define ESP_LOGW(TAG, ...) do { \
Serial.printf("[%6lu][W][%s]: ", (unsigned long) (micros() / 1000ULL), TAG); \
Serial.printf(__VA_ARGS__); \
Serial.println(); \
} while (0)
#define ESP_LOGI(TAG, ...) do { \
Serial.printf("[%6lu][I][%s]: ", (unsigned long) (micros() / 1000ULL), TAG); \
Serial.printf(__VA_ARGS__); \
Serial.println(); \
} while (0)
#define ESP_LOGW(TAG, ...) do { \
Serial.printf("[%6lu][W][%s]: ", (unsigned long) (micros() / 1000ULL), TAG); \
#define ESP_LOGD(TAG, ...) do { \
Serial.printf("[%6lu][D][%s]: ", (unsigned long) (micros() / 1000ULL), TAG); \
Serial.printf(__VA_ARGS__); \
Serial.println(); \
} while (0)
#define ESP_LOGV(TAG, ...) do { \
Serial.printf("[%6lu][V][%s]: ", (unsigned long) (micros() / 1000ULL), TAG); \
Serial.printf(__VA_ARGS__); \
Serial.println(); \
} while (0)
Expand Down

0 comments on commit 4881214

Please sign in to comment.