[core] Allow disabling LT logger programmatically
This commit is contained in:
@@ -50,6 +50,9 @@ void lt_log(const uint8_t level, const char *caller, const unsigned short line,
|
||||
void lt_log(const uint8_t level, const char *format, ...) {
|
||||
#endif
|
||||
|
||||
if (uart_port == 0xFF)
|
||||
return;
|
||||
|
||||
#if LT_LOGGER_TIMESTAMP
|
||||
float seconds = millis() / 1000.0f;
|
||||
#if LT_PRINTF_BROKEN
|
||||
@@ -136,3 +139,7 @@ void lt_log(const uint8_t level, const char *format, ...) {
|
||||
void lt_log_set_port(uint8_t port) {
|
||||
uart_port = port;
|
||||
}
|
||||
|
||||
void lt_log_disable() {
|
||||
uart_port = 0xFF;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,11 @@ void lt_log(const uint8_t level, const char *format, ...);
|
||||
*/
|
||||
void lt_log_set_port(uint8_t port);
|
||||
|
||||
/**
|
||||
* @brief Disable LT logger. Enable it back using lt_log_set_port(LT_UART_DEFAULT_LOGGER).
|
||||
*/
|
||||
void lt_log_disable();
|
||||
|
||||
#if LT_LEVEL_TRACE >= LT_LOGLEVEL
|
||||
#define LT_T(...) LT_LOG(LT_LEVEL_TRACE, __FUNCTION__, __LINE__, __VA_ARGS__)
|
||||
#define LT_V(...) LT_LOG(LT_LEVEL_TRACE, __FUNCTION__, __LINE__, __VA_ARGS__)
|
||||
|
||||
Reference in New Issue
Block a user