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.
|
Implementation of the MeshX logging system. More...
#include "meshx_log.h"
#include "module_id.h"
#include "interface/rtos/meshx_rtos_utils.h"
#include <stdio.h>
#include <stdarg.h>
Go to the source code of this file.
Functions | |
meshx_err_t | meshx_logging_init (const meshx_logging_t *config) |
Initializes the MeshX logging system with the provided configuration. | |
void | meshx_module_set_log_level (module_id_t module_id, meshx_log_level_t log_level) |
Sets the logging level for a specified module. | |
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. | |
Variables | |
static meshx_log_level_t | module_log_level [MODULE_ID_MAX] |
static const char * | log_lvl_str [MESHX_LOG_MAX] |
static meshx_logging_t | meshx_logging_ctrl |
Implementation of the MeshX logging system.
This file contains the implementation of the logging system for the MeshX application. It provides functions to initialize the logging system, set logging levels for specific modules, and log formatted messages with different log levels and colors.
The logging system supports different modules identified by module IDs, and each module can have its own logging level. The log levels determine the verbosity of the log messages. The system also supports colored log messages for different log levels.
The logging system requires a configuration structure to be initialized, which includes a default log level and a callback function to retrieve the current time in milliseconds.
The main functions provided are:
The file also defines macros for logging messages at different levels, such as error, warning, info, and debug.
Definition in file meshx_log.c.
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.
void meshx_module_set_log_level | ( | module_id_t | module_id, |
meshx_log_level_t | log_level ) |
Sets the logging level for a specified module.
This function assigns a new logging level to a given module identified by its module ID. The logging level determines the verbosity of log messages for that module.
[in] | module_id | The ID of the module whose log level is to be set. |
[in] | log_level | The new logging level to be assigned to the module. |
Definition at line 85 of file meshx_log.c.
|
static |
Definition at line 41 of file meshx_log.c.
|
static |
Definition at line 46 of file meshx_log.c.
|
static |
Definition at line 39 of file meshx_log.c.