WiFi Logger component  1.0
WiFi Logger component, uses wifi to output logs
wifi_logger.h
Go to the documentation of this file.
1 #ifndef WIFI_LOGGER_H
2 #define WIFI_LOGGER_H
3 
4 #include "tcp_handler.h"
5 #include "udp_handler.h"
6 #include "websocket_handler.h"
7 #include "utils.h"
8 #include "freertos/FreeRTOS.h"
9 #include "freertos/task.h"
10 #include "esp_system.h"
11 #include "freertos/queue.h"
12 
13 QueueHandle_t wifi_logger_queue;
14 
15 #define MESSAGE_QUEUE_SIZE CONFIG_MESSAGE_QUEUE_SIZE
16 #define BUFFER_SIZE CONFIG_BUFFER_SIZE
17 
18 #define wifi_log_e(TAG, fmt, ...) generate_log_message(ESP_LOG_ERROR, TAG, __LINE__, __func__, fmt, __VA_ARGS__);
19 #define wifi_log_w(TAG, fmt, ...) generate_log_message(ESP_LOG_WARN, TAG, __LINE__, __func__, fmt, __VA_ARGS__);
20 #define wifi_log_i(TAG, fmt, ...) generate_log_message(ESP_LOG_INFO, TAG, __LINE__, __func__, fmt, __VA_ARGS__);
21 #define wifi_log_d(TAG, fmt, ...) generate_log_message(ESP_LOG_DEBUG, TAG, __LINE__, __func__, fmt, __VA_ARGS__);
22 #define wifi_log_v(TAG, fmt, ...) generate_log_message(ESP_LOG_VERBOSE, TAG, __LINE__, __func__, fmt, __VA_ARGS__);
23 
24 esp_err_t init_queue(void);
25 void init_wifi(void);
26 esp_err_t send_to_queue(char* log_message);
27 char* receive_from_queue(void);
28 void generate_log_message(esp_log_level_t level, const char *TAG, int line, const char *func, const char *fmt, ...);
29 int system_log_message_route(const char* fmt, va_list tag);
30 void start_wifi_logger(void);
31 void wifi_logger();
32 
33 #endif
34 
void wifi_logger()
QueueHandle_t wifi_logger_queue
Definition: wifi_logger.h:13
void start_wifi_logger(void)
wrapper function to start wifi logger
Definition: wifi_logger.c:179
int system_log_message_route(const char *fmt, va_list tag)
route log messages generated by ESP_LOGX to the wifi logger
Definition: wifi_logger.c:165
char * receive_from_queue(void)
Receive data from queue. Timeout is set to portMAX_DELAY, which is around 50 days (confirm from esp32...
Definition: wifi_logger.c:70
esp_err_t send_to_queue(char *log_message)
Sends log message to message queue.
Definition: wifi_logger.c:44
esp_err_t init_queue(void)
Initialises message queue.
Definition: wifi_logger.c:10
void init_wifi(void)
Initialises and connects to wifi.
Definition: wifi_logger.c:29
void generate_log_message(esp_log_level_t level, const char *TAG, int line, const char *func, const char *fmt,...)
generates log message, of the format generated by ESP_LOG function
Definition: wifi_logger.c:112