MeshX 0.3
This repository provides an implementation for Bluetooth Low Energy (BLE) Mesh network nodes. The project allows you to create BLE mesh nodes that can communicate with each other, enabling the development of smart home solutions or other IoT-based applications.
|
Logging interface for MeshX with color-coded output. More...
Go to the source code of this file.
Data Structures | |
struct | meshx_logging |
Macros | |
#define | CONFIG_MESHX_LOG_PRINTF printf |
Macro to define printf function. | |
#define | CONFIG_MESHX_DEFAULT_LOG_LEVEL MESHX_LOG_INFO |
#define | MESHX_LOG_COLOR_BLACK "\033[0;30m" |
#define | MESHX_LOG_COLOR_RED "\033[0;31m" |
#define | MESHX_LOG_COLOR_GREEN "\033[0;32m" |
#define | MESHX_LOG_COLOR_YELLOW "\033[0;33m" |
#define | MESHX_LOG_COLOR_BLUE "\033[0;34m" |
#define | MESHX_LOG_COLOR_PURPLE "\033[0;35m" |
#define | MESHX_LOG_COLOR_CYAN "\033[0;36m" |
#define | MESHX_LOG_COLOR_WHITE "\033[0;37m" |
#define | MESHX_LOG_COLOR_RESET "\033[0m" |
#define | MESHX_LOG_VERBOSE 0 /* White */ |
#define | MESHX_LOG_DEBUG 1 /* Blue */ |
#define | MESHX_LOG_INFO 2 /* Green */ |
#define | MESHX_LOG_WARN 3 /* Yellow */ |
#define | MESHX_LOG_ERROR 4 /* Red */ |
#define | MESHX_LOG_NONE 5 /* Blue */ |
#define | MESHX_LOG_MAX 6 |
#define | MESHX_LOG_LEVEL_COLOR(level) |
#define | MESHX_LOG(module_id, level, format, ...) |
#define | MESHX_LOGE(module_id, format, ...) |
#define | MESHX_LOGW(module_id, format, ...) |
#define | MESHX_LOGI(module_id, format, ...) |
#define | MESHX_LOGD(module_id, format, ...) |
Typedefs | |
typedef unsigned | meshx_log_level_t |
typedef unsigned int(* | millis_t) (void) |
typedef struct meshx_logging | meshx_logging_t |
Functions | |
meshx_err_t | meshx_logging_init (const meshx_logging_t *config) |
Initializes the MeshX logging system with the provided configuration. | |
MESHX_WEEK void | meshx_log_printf (module_id_t module_id, meshx_log_level_t log_level, const char *func, int line_no, const char *fmt,...) |
Logs a formatted message for a specified module and log level. | |
Logging interface for MeshX with color-coded output.
Definition in file meshx_log.h.
#define CONFIG_MESHX_DEFAULT_LOG_LEVEL MESHX_LOG_INFO |
Definition at line 23 of file meshx_log.h.
#define CONFIG_MESHX_LOG_PRINTF printf |
Macro to define printf function.
Definition at line 19 of file meshx_log.h.
#define MESHX_LOG | ( | module_id, | |
level, | |||
format, | |||
... ) |
Definition at line 64 of file meshx_log.h.
#define MESHX_LOG_COLOR_BLACK "\033[0;30m" |
Definition at line 27 of file meshx_log.h.
#define MESHX_LOG_COLOR_BLUE "\033[0;34m" |
Definition at line 31 of file meshx_log.h.
#define MESHX_LOG_COLOR_CYAN "\033[0;36m" |
Definition at line 33 of file meshx_log.h.
#define MESHX_LOG_COLOR_GREEN "\033[0;32m" |
Definition at line 29 of file meshx_log.h.
#define MESHX_LOG_COLOR_PURPLE "\033[0;35m" |
Definition at line 32 of file meshx_log.h.
#define MESHX_LOG_COLOR_RED "\033[0;31m" |
Definition at line 28 of file meshx_log.h.
#define MESHX_LOG_COLOR_RESET "\033[0m" |
Definition at line 35 of file meshx_log.h.
#define MESHX_LOG_COLOR_WHITE "\033[0;37m" |
Definition at line 34 of file meshx_log.h.
#define MESHX_LOG_COLOR_YELLOW "\033[0;33m" |
Definition at line 30 of file meshx_log.h.
#define MESHX_LOG_DEBUG 1 /* Blue */ |
Definition at line 40 of file meshx_log.h.
#define MESHX_LOG_ERROR 4 /* Red */ |
Definition at line 43 of file meshx_log.h.
#define MESHX_LOG_INFO 2 /* Green */ |
Definition at line 41 of file meshx_log.h.
#define MESHX_LOG_LEVEL_COLOR | ( | level | ) |
Definition at line 57 of file meshx_log.h.
#define MESHX_LOG_MAX 6 |
Definition at line 45 of file meshx_log.h.
#define MESHX_LOG_NONE 5 /* Blue */ |
Definition at line 44 of file meshx_log.h.
#define MESHX_LOG_VERBOSE 0 /* White */ |
Definition at line 39 of file meshx_log.h.
#define MESHX_LOG_WARN 3 /* Yellow */ |
Definition at line 42 of file meshx_log.h.
#define MESHX_LOGD | ( | module_id, | |
format, | |||
... ) |
Definition at line 113 of file meshx_log.h.
#define MESHX_LOGE | ( | module_id, | |
format, | |||
... ) |
Definition at line 73 of file meshx_log.h.
#define MESHX_LOGI | ( | module_id, | |
format, | |||
... ) |
Definition at line 100 of file meshx_log.h.
#define MESHX_LOGW | ( | module_id, | |
format, | |||
... ) |
Definition at line 87 of file meshx_log.h.
typedef unsigned meshx_log_level_t |
Definition at line 47 of file meshx_log.h.
typedef struct meshx_logging meshx_logging_t |
typedef unsigned int(* millis_t) (void) |
Definition at line 49 of file meshx_log.h.
MESHX_WEEK void meshx_log_printf | ( | module_id_t | module_id, |
meshx_log_level_t | log_level, | ||
const char * | func, | ||
int | line_no, | ||
const char * | fmt, | ||
... ) |
Logs a formatted message for a specified module and log level.
This function checks if the provided module ID and log level are valid and above the current global and module-specific log levels. If valid, it processes the variable arguments to format and log the message.
[in] | module_id | The ID of the module for which the log is generated. |
[in] | log_level | The log level of the message. |
[in] | func | The name of the function where the log is called. |
[in] | line_no | The line number in the source code where the log is called. |
[in] | fmt | The format string for the log message. |
[in] | ... | Additional arguments for the format string. |
Definition at line 109 of file meshx_log.c.
meshx_err_t meshx_logging_init | ( | const meshx_logging_t * | config | ) |
Initializes the MeshX logging system with the provided configuration.
This function sets up the logging system by assigning the default log level and the callback function for retrieving the current time in milliseconds. It validates the configuration parameters and returns an error if they are invalid.
[in] | config | Pointer to the logging configuration structure. |
Definition at line 61 of file meshx_log.c.