WiFi Logger component  1.0
WiFi Logger component, uses wifi to output logs
Macros | Functions | Variables
wifi_logger.h File Reference
#include "tcp_handler.h"
#include "udp_handler.h"
#include "websocket_handler.h"
#include "utils.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
#include "freertos/queue.h"
Include dependency graph for wifi_logger.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MESSAGE_QUEUE_SIZE   CONFIG_MESSAGE_QUEUE_SIZE
 
#define BUFFER_SIZE   CONFIG_BUFFER_SIZE
 
#define wifi_log_e(TAG, fmt, ...)   generate_log_message(ESP_LOG_ERROR, TAG, __LINE__, __func__, fmt, __VA_ARGS__);
 
#define wifi_log_w(TAG, fmt, ...)   generate_log_message(ESP_LOG_WARN, TAG, __LINE__, __func__, fmt, __VA_ARGS__);
 
#define wifi_log_i(TAG, fmt, ...)   generate_log_message(ESP_LOG_INFO, TAG, __LINE__, __func__, fmt, __VA_ARGS__);
 
#define wifi_log_d(TAG, fmt, ...)   generate_log_message(ESP_LOG_DEBUG, TAG, __LINE__, __func__, fmt, __VA_ARGS__);
 
#define wifi_log_v(TAG, fmt, ...)   generate_log_message(ESP_LOG_VERBOSE, TAG, __LINE__, __func__, fmt, __VA_ARGS__);
 

Functions

esp_err_t init_queue (void)
 Initialises message queue. More...
 
void init_wifi (void)
 Initialises and connects to wifi. More...
 
esp_err_t send_to_queue (char *log_message)
 Sends log message to message queue. More...
 
char * receive_from_queue (void)
 Receive data from queue. Timeout is set to portMAX_DELAY, which is around 50 days (confirm from esp32 specs) More...
 
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 More...
 
int system_log_message_route (const char *fmt, va_list tag)
 route log messages generated by ESP_LOGX to the wifi logger More...
 
void start_wifi_logger (void)
 wrapper function to start wifi logger More...
 
void wifi_logger ()
 

Variables

QueueHandle_t wifi_logger_queue
 

Macro Definition Documentation

◆ BUFFER_SIZE

#define BUFFER_SIZE   CONFIG_BUFFER_SIZE

◆ MESSAGE_QUEUE_SIZE

#define MESSAGE_QUEUE_SIZE   CONFIG_MESSAGE_QUEUE_SIZE

◆ wifi_log_d

#define wifi_log_d (   TAG,
  fmt,
  ... 
)    generate_log_message(ESP_LOG_DEBUG, TAG, __LINE__, __func__, fmt, __VA_ARGS__);

◆ wifi_log_e

#define wifi_log_e (   TAG,
  fmt,
  ... 
)    generate_log_message(ESP_LOG_ERROR, TAG, __LINE__, __func__, fmt, __VA_ARGS__);

◆ wifi_log_i

#define wifi_log_i (   TAG,
  fmt,
  ... 
)    generate_log_message(ESP_LOG_INFO, TAG, __LINE__, __func__, fmt, __VA_ARGS__);

◆ wifi_log_v

#define wifi_log_v (   TAG,
  fmt,
  ... 
)    generate_log_message(ESP_LOG_VERBOSE, TAG, __LINE__, __func__, fmt, __VA_ARGS__);

◆ wifi_log_w

#define wifi_log_w (   TAG,
  fmt,
  ... 
)    generate_log_message(ESP_LOG_WARN, TAG, __LINE__, __func__, fmt, __VA_ARGS__);

Function Documentation

◆ generate_log_message()

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

Parameters
levelset ESP LOG level {E, W, I, D, V}
TAGTag for the log message
lineline
funcfunc
fmtfmt

◆ init_queue()

esp_err_t init_queue ( void  )

Initialises message queue.

Returns
esp_err_t ESP_OK - if queue init sucessfully, ESP_FAIL - if queue init failed

◆ init_wifi()

void init_wifi ( void  )

Initialises and connects to wifi.

◆ receive_from_queue()

char* receive_from_queue ( void  )

Receive data from queue. Timeout is set to portMAX_DELAY, which is around 50 days (confirm from esp32 specs)

Returns
char* - returns log message received from the queue, returns NULL if error

◆ send_to_queue()

esp_err_t send_to_queue ( char *  log_message)

Sends log message to message queue.

Parameters
log_messagelog message to be sent to the queue
Returns
esp_err_t ESP_OK - if queue init sucessfully, ESP_FAIL - if queue init failed

◆ start_wifi_logger()

void start_wifi_logger ( void  )

wrapper function to start wifi logger

◆ system_log_message_route()

int system_log_message_route ( const char *  fmt,
va_list  tag 
)

route log messages generated by ESP_LOGX to the wifi logger

Parameters
fmtlogger string format
tagarguments
Returns
int return value of vprintf

◆ wifi_logger()

void wifi_logger ( )

Variable Documentation

◆ wifi_logger_queue

QueueHandle_t wifi_logger_queue