Skip to content

Commit af381e4

Browse files
committed
timestamps for NimBLELog messages
1 parent f789215 commit af381e4

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/NimBLELog.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,27 +147,28 @@
147147

148148
# else
149149
# include "nimble/console/console.h"
150+
# include "esp32-hal.h"
150151

151152
# if MYNEWT_VAL(NIMBLE_CPP_LOG_LEVEL) >= 4
152-
# define NIMBLE_LOGD(tag, format, ...) console_printf("D %s: " format "\n", tag, ##__VA_ARGS__)
153+
# define NIMBLE_LOGD(tag, format, ...) console_printf("D (%lu) %s: " format "\n", millis(), tag, ##__VA_ARGS__)
153154
# else
154155
# define NIMBLE_LOGD(tag, format, ...) (void)tag
155156
# endif
156157

157158
# if MYNEWT_VAL(NIMBLE_CPP_LOG_LEVEL) >= 3
158-
# define NIMBLE_LOGI(tag, format, ...) console_printf("I %s: " format "\n", tag, ##__VA_ARGS__)
159+
# define NIMBLE_LOGI(tag, format, ...) console_printf("I (%lu) %s: " format "\n", millis(), tag, ##__VA_ARGS__)
159160
# else
160161
# define NIMBLE_LOGI(tag, format, ...) (void)tag
161162
# endif
162163

163164
# if MYNEWT_VAL(NIMBLE_CPP_LOG_LEVEL) >= 2
164-
# define NIMBLE_LOGW(tag, format, ...) console_printf("W %s: " format "\n", tag, ##__VA_ARGS__)
165+
# define NIMBLE_LOGW(tag, format, ...) console_printf("W (%lu) %s: " format "\n", millis(), tag, ##__VA_ARGS__)
165166
# else
166167
# define NIMBLE_LOGW(tag, format, ...) (void)tag
167168
# endif
168169

169170
# if MYNEWT_VAL(NIMBLE_CPP_LOG_LEVEL) >= 1
170-
# define NIMBLE_LOGE(tag, format, ...) console_printf("E %s: " format "\n", tag, ##__VA_ARGS__)
171+
# define NIMBLE_LOGE(tag, format, ...) console_printf("E (%lu) %s: " format "\n", millis(), tag, ##__VA_ARGS__)
171172
# else
172173
# define NIMBLE_LOGE(tag, format, ...) (void)tag
173174
# endif

0 commit comments

Comments
 (0)