Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 55b8f67

Browse filesBrowse files
authored
In esp32-hal-log, direct calls to ESP_LOG_x macros is more efficient than using intermediate function log_to_esp (espressif#5081)
As indicated in espressif#4845 (comment) it is more efficient to call directly the ESP LOG macros. This spares a function call, a 512b buffer and a call to vsnprintf. No change in functionality.
1 parent 9c20f1b commit 55b8f67
Copy full SHA for 55b8f67

File tree

Expand file treeCollapse file tree

3 files changed

+5
-26
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+5
-26
lines changed

‎CMakeLists.txt

Copy file name to clipboardExpand all lines: CMakeLists.txt
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ set(CORE_SRCS
77
cores/esp32/esp32-hal-dac.c
88
cores/esp32/esp32-hal-gpio.c
99
cores/esp32/esp32-hal-i2c.c
10-
cores/esp32/esp32-hal-log.c
1110
cores/esp32/esp32-hal-ledc.c
1211
cores/esp32/esp32-hal-matrix.c
1312
cores/esp32/esp32-hal-misc.c

‎cores/esp32/esp32-hal-log.c

Copy file name to clipboardExpand all lines: cores/esp32/esp32-hal-log.c
-19Lines changed: 0 additions & 19 deletions
This file was deleted.

‎cores/esp32/esp32-hal-log.h

Copy file name to clipboardExpand all lines: cores/esp32/esp32-hal-log.h
+5-6Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ int log_printf(const char *fmt, ...);
8888
#define log_v(format, ...) log_printf(ARDUHAL_LOG_FORMAT(V, format), ##__VA_ARGS__)
8989
#define isr_log_v(format, ...) ets_printf(ARDUHAL_LOG_FORMAT(V, format), ##__VA_ARGS__)
9090
#else
91-
#define log_v(format, ...) do {log_to_esp(TAG, ESP_LOG_VERBOSE, format, ##__VA_ARGS__);}while(0)
91+
#define log_v(format, ...) do {ESP_LOG_LEVEL_LOCAL(ESP_LOG_VERBOSE, TAG, format, ##__VA_ARGS__);}while(0)
9292
#define isr_log_v(format, ...) do {ets_printf(LOG_FORMAT(V, format), esp_log_timestamp(), TAG, ##__VA_ARGS__);}while(0)
9393
#endif
9494
#else
@@ -101,7 +101,7 @@ int log_printf(const char *fmt, ...);
101101
#define log_d(format, ...) log_printf(ARDUHAL_LOG_FORMAT(D, format), ##__VA_ARGS__)
102102
#define isr_log_d(format, ...) ets_printf(ARDUHAL_LOG_FORMAT(D, format), ##__VA_ARGS__)
103103
#else
104-
#define log_d(format, ...) do {log_to_esp(TAG, ESP_LOG_DEBUG, format, ##__VA_ARGS__);}while(0)
104+
#define log_d(format, ...) do {ESP_LOG_LEVEL_LOCAL(ESP_LOG_DEBUG, TAG, format, ##__VA_ARGS__);}while(0)
105105
#define isr_log_d(format, ...) do {ets_printf(LOG_FORMAT(D, format), esp_log_timestamp(), TAG, ##__VA_ARGS__);}while(0)
106106
#endif
107107
#else
@@ -114,7 +114,7 @@ int log_printf(const char *fmt, ...);
114114
#define log_i(format, ...) log_printf(ARDUHAL_LOG_FORMAT(I, format), ##__VA_ARGS__)
115115
#define isr_log_i(format, ...) ets_printf(ARDUHAL_LOG_FORMAT(I, format), ##__VA_ARGS__)
116116
#else
117-
#define log_i(format, ...) do {log_to_esp(TAG, ESP_LOG_INFO, format, ##__VA_ARGS__);}while(0)
117+
#define log_i(format, ...) do {ESP_LOG_LEVEL_LOCAL(ESP_LOG_INFO, TAG, format, ##__VA_ARGS__);}while(0)
118118
#define isr_log_i(format, ...) do {ets_printf(LOG_FORMAT(I, format), esp_log_timestamp(), TAG, ##__VA_ARGS__);}while(0)
119119
#endif
120120
#else
@@ -127,7 +127,7 @@ int log_printf(const char *fmt, ...);
127127
#define log_w(format, ...) log_printf(ARDUHAL_LOG_FORMAT(W, format), ##__VA_ARGS__)
128128
#define isr_log_w(format, ...) ets_printf(ARDUHAL_LOG_FORMAT(W, format), ##__VA_ARGS__)
129129
#else
130-
#define log_w(format, ...) do {log_to_esp(TAG, ESP_LOG_WARN, format, ##__VA_ARGS__);}while(0)
130+
#define log_w(format, ...) do {ESP_LOG_LEVEL_LOCAL(ESP_LOG_WARN, TAG, format, ##__VA_ARGS__);}while(0)
131131
#define isr_log_w(format, ...) do {ets_printf(LOG_FORMAT(W, format), esp_log_timestamp(), TAG, ##__VA_ARGS__);}while(0)
132132
#endif
133133
#else
@@ -153,7 +153,7 @@ int log_printf(const char *fmt, ...);
153153
#define log_n(format, ...) log_printf(ARDUHAL_LOG_FORMAT(E, format), ##__VA_ARGS__)
154154
#define isr_log_n(format, ...) ets_printf(ARDUHAL_LOG_FORMAT(E, format), ##__VA_ARGS__)
155155
#else
156-
#define log_n(format, ...) do {log_to_esp(TAG, ESP_LOG_ERROR, format, ##__VA_ARGS__);}while(0)
156+
#define log_n(format, ...) do {ESP_LOG_LEVEL_LOCAL(ESP_LOG_ERROR, TAG, format, ##__VA_ARGS__);}while(0)
157157
#define isr_log_n(format, ...) do {ets_printf(LOG_FORMAT(E, format), esp_log_timestamp(), TAG, ##__VA_ARGS__);}while(0)
158158
#endif
159159
#else
@@ -167,7 +167,6 @@ int log_printf(const char *fmt, ...);
167167
#ifndef TAG
168168
#define TAG "ARDUINO"
169169
#endif
170-
void log_to_esp(char* tag, esp_log_level_t level, const char* format, ...);
171170
//#define log_n(format, ...) myLog(ESP_LOG_NONE, format, ##__VA_ARGS__)
172171
#else
173172
#ifdef CONFIG_ARDUHAL_ESP_LOG

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.