11#include <freertos/FreeRTOS.h>
15 explicit Logger() =
default;
18 QueueHandle_t queue_handle =
nullptr;
19 bool use_queue =
false;
37 static Logger _instance;
49 void custom_log(esp_log_level_t level,
const char* tag,
const char* format, ...) const __attribute__((format(printf, 4, 5)));
70#define LOGV(format, ...) Logger::get_instance().custom_log(ESP_LOG_VERBOSE, TAG, format, ##__VA_ARGS__)
71#define LOGD(format, ...) Logger::get_instance().custom_log(ESP_LOG_DEBUG, TAG, format, ##__VA_ARGS__)
72#define LOGI(format, ...) Logger::get_instance().custom_log(ESP_LOG_INFO, TAG, format, ##__VA_ARGS__)
73#define LOGW(format, ...) Logger::get_instance().custom_log(ESP_LOG_WARN, TAG, format, ##__VA_ARGS__)
74#define LOGE(format, ...) Logger::get_instance().custom_log(ESP_LOG_ERROR, TAG, format, ##__VA_ARGS__)
void custom_log(esp_log_level_t level, const char *tag, const char *format,...) const __attribute__((format(printf
Either directly invokes render_to_console (real mode) or sends to the queue (queue mode).
Definition logger.cpp:40
static Logger & get_instance()
Returns a reference to the static logger instance.
Definition logger.h:36
void switch_to_queue_logging(QueueHandle_t log_queue_handle)
Switches the logger's mode to queue logging.
Definition logger.cpp:74
void void print_linefeed() const
Prints a \n in the currently selected mode.
Definition logger.cpp:63
void process_log_queue() const
Processes all entries in the log queue.
Definition logger.cpp:79
bool is_linefeed
Definition logger.h:26
char * message
Definition logger.h:25
const char * tag
Definition logger.h:24
esp_log_level_t level
Definition logger.h:23