@@ -68,6 +68,11 @@ class NimBLEStream : public Stream {
6868 void setTxTaskStackSize (uint32_t size) { m_txTaskStackSize = size; }
6969 void setTxTaskPriority (uint32_t priority) { m_txTaskPriority = priority; }
7070
71+ // These logging macros exist to provide log output over UART so that the stream class can
72+ // be used to redirect logs without causing recursion issues.
73+ static int uart_log_printfv (const char * format, va_list arg);
74+ static int uart_log_printf (const char * format, ...);
75+
7176 // Print/Stream TX methods
7277 virtual size_t write (const uint8_t * data, size_t len) override ;
7378 virtual size_t write (uint8_t data) override { return write (&data, 1 ); }
@@ -201,31 +206,26 @@ class NimBLEStreamClient : public NimBLEStream {
201206
202207# endif // CONFIG_BT_NIMBLE_ENABLED && (MYNEWT_VAL(BLE_ROLE_PERIPHERAL) || MYNEWT_VAL(BLE_ROLE_CENTRAL))
203208
204- // These logging macros exist to provide log output over UART so that it stream classes can
205- // be used to redirect logs without causing recursion issues.
206- static int uart_log_printfv (const char * format, va_list arg);
207- static int uart_log_printf (const char * format, ...);
208-
209209# if MYNEWT_VAL(NIMBLE_CPP_LOG_LEVEL) >= 4
210- # define NIMBLE_UART_LOGD (tag, format, ...) uart_log_printf(" D %s: " format " \n " , tag, ##__VA_ARGS__)
210+ # define NIMBLE_UART_LOGD (tag, format, ...) NimBLEStream:: uart_log_printf(" D %s: " format " \n " , tag, ##__VA_ARGS__)
211211# else
212212# define NIMBLE_UART_LOGD (tag, format, ...) (void )tag
213213# endif
214214
215215# if MYNEWT_VAL(NIMBLE_CPP_LOG_LEVEL) >= 3
216- # define NIMBLE_UART_LOGI (tag, format, ...) uart_log_printf(" I %s: " format " \n " , tag, ##__VA_ARGS__)
216+ # define NIMBLE_UART_LOGI (tag, format, ...) NimBLEStream:: uart_log_printf(" I %s: " format " \n " , tag, ##__VA_ARGS__)
217217# else
218218# define NIMBLE_UART_LOGI (tag, format, ...) (void )tag
219219# endif
220220
221221# if MYNEWT_VAL(NIMBLE_CPP_LOG_LEVEL) >= 2
222- # define NIMBLE_UART_LOGW (tag, format, ...) uart_log_printf(" W %s: " format " \n " , tag, ##__VA_ARGS__)
222+ # define NIMBLE_UART_LOGW (tag, format, ...) NimBLEStream:: uart_log_printf(" W %s: " format " \n " , tag, ##__VA_ARGS__)
223223# else
224224# define NIMBLE_UART_LOGW (tag, format, ...) (void )tag
225225# endif
226226
227227# if MYNEWT_VAL(NIMBLE_CPP_LOG_LEVEL) >= 1
228- # define NIMBLE_UART_LOGE (tag, format, ...) uart_log_printf(" E %s: " format " \n " , tag, ##__VA_ARGS__)
228+ # define NIMBLE_UART_LOGE (tag, format, ...) NimBLEStream:: uart_log_printf(" E %s: " format " \n " , tag, ##__VA_ARGS__)
229229# else
230230# define NIMBLE_UART_LOGE (tag, format, ...) (void )tag
231231# endif
0 commit comments