11 #if defined(USE_ESP8266) || defined(USE_ESP32) 12 #include <HardwareSerial.h> 13 #endif // USE_ESP8266 || USE_ESP32 15 #include <HardwareSerial.h> 16 #include <SerialUSB.h> 21 #include <driver/uart.h> 28 #if defined(USE_ESP32) || defined(USE_ESP8266) || defined(USE_RP2040) || defined(USE_LIBRETINY) 41 #if defined(USE_LIBRETINY) || defined(USE_ESP32_VARIANT_ESP32) 44 #ifdef USE_LOGGER_USB_CDC 47 #ifdef USE_LOGGER_USB_SERIAL_JTAG 54 #endif // USE_ESP32 || USE_ESP8266 || USE_RP2040 || USE_LIBRETINY 58 explicit Logger(uint32_t baud_rate,
size_t tx_buffer_size);
59 #ifdef USE_LOGGER_USB_CDC 71 #if defined(USE_ESP32) || defined(USE_ESP8266) || defined(USE_RP2040) || defined(USE_LIBRETINY) 93 void log_vprintf_(
int level,
const char *tag,
int line,
const char *format, va_list args);
94 #ifdef USE_STORE_LOG_STR_IN_FLASH 95 void log_vprintf_(
int level,
const char *tag,
int line,
const __FlashStringHelper *format, va_list args);
101 void log_message_(
int level,
const char *tag,
int offset = 0);
129 if (ret >= remaining) {
137 va_start(arg, format);
150 #if defined(USE_ESP32) || defined(USE_ESP8266) || defined(USE_RP2040) 178 this->level_ =
level;
180 if (level <= this->level_) {
181 this->trigger(level, tag, message);
void set_baud_rate(uint32_t baud_rate)
Manually set the baud rate for serial, set to 0 to disable.
void add_on_log_callback(std::function< void(int, const char *, const char *)> &&callback)
Register a callback that will be called for every log message sent.
UARTSelection
Enum for logging UART selection.
void set_uart_selection(UARTSelection uart_selection)
int level_for(const char *tag)
LoggerMessageTrigger(Logger *parent, int level)
void log_vprintf_(int level, const char *tag, int line, const char *format, va_list args)
int buffer_remaining_capacity_() const
void vprintf_to_buffer_(const char *format, va_list args)
void dump_config() override
float get_setup_priority() const override
Logger(uint32_t baud_rate, size_t tx_buffer_size)
void write_header_(int level, const char *tag, int line)
void write_to_buffer_(const char *value, int length)
UARTSelection get_uart() const
Get the UART used by the logger.
void set_null_terminator_()
const char * get_uart_selection_()
void printf_to_buffer_(const char *format,...)
void write_to_buffer_(char value)
void pre_setup()
Set up this component.
Stream * get_hw_serial() const
uint32_t get_baud_rate() const
void log_message_(int level, const char *tag, int offset=0)
Implementation of SPI Controller mode.
std::vector< LogLevelOverride > log_levels_
uart_port_t get_uart_num() const
void set_log_level(const std::string &tag, int log_level)
Set the log level of the specified tag.
void write_msg_(const char *msg)
bool recursion_guard_
Prevents recursive log calls, if true a log message is already being processed.
CallbackManager< void(int, const char *, const char *)> log_callback_
bool is_buffer_full_() const