Debug support
Middleware has extended debugging capabilities. These consist of different debugging levels and types of debug messages, allowing to track and catch different types of warnings, severe problems or simply output messages program flow messages (trace messages).
Module is highly configurable using library configuration methods. Application must enable some options to decide what type of messages and for which modules it would like to output messages.
With default configuration, printf
is used as output function.
This behavior can be changed with LWESP_CFG_DBG_OUT
configuration.
For successful debugging, application must:
Enable global debugging by setting
LWESP_CFG_DBG
toLWESP_DBG_ON
Configure which types of messages to output
Configure debugging level, from all messages to severe only
Enable specific modules to debug, by setting its configuration value to
LWESP_DBG_ON
Tip
Check Configuration for all modules with debug implementation.
An example code with config and latter usage:
1/* Modifications of lwesp_opts.h file for configuration */
2
3/* Enable global debug */
4#define LWESP_CFG_DBG LWESP_DBG_ON
5
6/*
7 * Enable debug types.
8 * Application may use bitwise OR | to use multiple types:
9 * LWESP_DBG_TYPE_TRACE | LWESP_DBG_TYPE_STATE
10 */
11#define LWESP_CFG_DBG_TYPES_ON LWESP_DBG_TYPE_TRACE
12
13/* Enable debug on custom module */
14#define MY_DBG_MODULE LWESP_DBG_ON
1#include "lwesp/lwesp_debug.h"
2
3/*
4 * Print debug message to the screen
5 * Trace message will be printed as it is enabled in types
6 * while state message will not be printed.
7 */
8LWESP_DEBUGF(MY_DBG_MODULE | LWESP_DBG_TYPE_TRACE, "This is trace message on my program\r\n");
9LWESP_DEBUGF(MY_DBG_MODULE | LWESP_DBG_TYPE_STATE, "This is state message on my program\r\n");
- group LWESP_DEBUG
Debug support module to track library flow.
Defines
-
LWESP_DEBUGF(c, fmt, ...)
Print message to the debug “window” if enabled.
- Parameters
c – [in] Condition if debug of specific type is enabled
fmt – [in] Formatted string for debug
... – [in] Variable parameters for formatted string
-
LWESP_DEBUGW(c, cond, fmt, ...)
Print message to the debug “window” if enabled when specific condition is met.
- Parameters
c – [in] Condition if debug of specific type is enabled
cond – [in] Debug only if this condition is true
fmt – [in] Formatted string for debug
... – [in] Variable parameters for formatted string
-
LWESP_DEBUGF(c, fmt, ...)