Logging Interface#
Logging Interface#
Interface for log for sidewalk SDK. For more details, please see Logging Documentation
Modules#
Functions#
Printf style logging function.
The function returns current logging level.
Flush log function.
String log pushing operation - in the case of JLink RTT logs since these are deferred, they require that a special function be used in order to ensure that strings are copied correctly in order for pushing then at a later time.
Allows for retrival of log buffers from sid_pal_log implementation.
Log raw data bytes.
Macros#
Define the maximum number of bytes per single line of sid_pal_hexdump() logging.
Macro to count the number of arguments in a variadic macro.
Helper macro to count the number of arguments in a variadic macro.
Helper macro to extract the number of arguments.
Macro to define a reverse sequence of numbers from 62 to 0.
Logs a message with the highest severity level.
Logs a message if the severity level is less than or equal to the configured log level.
Dumps a block of data in hexadecimal format.
Flushes the log buffer.
Pushes a string to the log.
Logs an error message with the highest severity level.
Logs a warning message if the severity level is greater than or equal to the warning level.
Logs an informational message if the severity level is greater than or equal to the info level.
Logs a debug message if the severity level is greater than or equal to the debug level.
Logs a trace message with file name, line number, and function name.
Logs a message if the severity level is less than or equal to the configured log level.
Logs an error message with the highest severity level.
Logs a warning message if the severity level is greater than or equal to the warning level.
Logs an informational message if the severity level is greater than or equal to the info level.
Logs a debug message if the severity level is greater than or equal to the debug level.
Flushes the log buffer.
Pushes a string to the log.
Dumps a block of data in hexadecimal format with error severity.
Dumps a block of data in hexadecimal format with warning severity.
Dumps a block of data in hexadecimal format with info severity.
Dumps a block of data in hexadecimal format with debug severity.
Function Documentation#
sid_pal_log#
void sid_pal_log (sid_pal_log_severity_t severity, uint32_t num_args, const char * fmt, ... )
Printf style logging function.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| sid_pal_log_severity_t | [in] | severity | Severity of the log |
| uint32_t | [in] | num_args | Number of arguments to be logged |
| const char * | [in] | fmt | Format string to print with variables |
| ... | N/A |
sid_log_control_get_current_log_level#
sid_pal_log_severity_t sid_log_control_get_current_log_level (void )
The function returns current logging level.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| void | N/A |
Implemented in sid_log_control
sid_pal_log_flush#
void sid_pal_log_flush (void )
Flush log function.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| void | N/A |
The function flushes the log buffers to the output interface
sid_pal_log_push_str#
char const * sid_pal_log_push_str (char * string)
String log pushing operation - in the case of JLink RTT logs since these are deferred, they require that a special function be used in order to ensure that strings are copied correctly in order for pushing then at a later time.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| char * | [in] | string | Pointer to the string that has to be copied. |
For platforms that do not use deferred logging, this can remain unimplemented.
sid_pal_log_get_log_buffer#
bool sid_pal_log_get_log_buffer (struct sid_pal_log_buffer *const log_buffer)
Allows for retrival of log buffers from sid_pal_log implementation.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| struct sid_pal_log_buffer *const | [in] | log_buffer | Pointer to log buffer descriptor |
OPTIONAL If business logic wants to send logs over an external connection they can use this api to pull out logs from sid_pal_log implementation if implemented. Internally the implementation can use a circular list of buffers to store the logs as they come.
sid_pal_hexdump#
void sid_pal_hexdump (sid_pal_log_severity_t severity, const void * address, int length)
Log raw data bytes.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| sid_pal_log_severity_t | [in] | severity | Severity of the log |
| const void * | [in] | address | Pointer to data to be logged |
| int | [in] | length | The length of data to be logged (in bytes) |
Macro Definition Documentation#
SID_PAL_HEXDUMP_MAX#
#define SID_PAL_HEXDUMP_MAXValue:
(8)
Define the maximum number of bytes per single line of sid_pal_hexdump() logging.
When the caller requests more bytes then the output will be split into multiple lines using SID_PAL_HEXDUMP_MAX bytes per line, plus eventual remainder in the last line.
SID_PAL_VA_NARG#
#define SID_PAL_VA_NARGValue:
(...)
Macro to count the number of arguments in a variadic macro.
This macro counts the number of arguments passed to it. It uses a combination of helper macros to achieve this.
Returns
The number of arguments passed.
SID_PAL_VA_NARG_#
#define SID_PAL_VA_NARG_Value:
(...)
Helper macro to count the number of arguments in a variadic macro.
This macro is used internally by SID_PAL_VA_NARG to count the number of arguments.
Returns
The number of arguments passed.
SID_PAL_VA_ARG_N#
#define SID_PAL_VA_ARG_NValue:
(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, N, ...)
Helper macro to extract the number of arguments.
This macro extracts the number of arguments from the list of arguments.
Returns
The number of arguments passed.
SID_PAL_RSEQ_N#
#define SID_PAL_RSEQ_NValue:
Macro to define a reverse sequence of numbers from 62 to 0.
This macro generates a sequence of numbers in descending order starting from 62 down to 0. It can be used in various contexts where such a sequence is required.
SID_PAL_LOG_HIGHEST_SEVIRITY#
#define SID_PAL_LOG_HIGHEST_SEVIRITY
Logs a message with the highest severity level.
SID_PAL_LOG#
#define SID_PAL_LOG
Logs a message if the severity level is less than or equal to the configured log level.
SID_PAL_LOG_FLUSH#
#define SID_PAL_LOG_FLUSH
Flushes the log buffer.
This macro calls the function to flush the log buffer.
SID_PAL_LOG_ERROR#
#define SID_PAL_LOG_ERRORValue:
(fmt_, ...)
Logs an error message with the highest severity level.
SID_PAL_LOG_WARNING#
#define SID_PAL_LOG_WARNINGValue:
(fmt_, ...)
Logs a warning message if the severity level is greater than or equal to the warning level.
SID_PAL_LOG_INFO#
#define SID_PAL_LOG_INFOValue:
(fmt_, ...)
Logs an informational message if the severity level is greater than or equal to the info level.
SID_PAL_LOG_DEBUG#
#define SID_PAL_LOG_DEBUGValue:
(fmt_, ...)
Logs a debug message if the severity level is greater than or equal to the debug level.
SID_PAL_LOG_TRACE#
#define SID_PAL_LOG_TRACEValue:
()
Logs a trace message with file name, line number, and function name.
This macro logs a trace message at the informational level, including the file name, line number, and function name where the macro is called.
SID_HAL_LOG#
#define SID_HAL_LOGValue:
Logs a message if the severity level is less than or equal to the configured log level.
SID_HAL_LOG_ERROR#
#define SID_HAL_LOG_ERRORValue:
(fmt_, ...)
Logs an error message with the highest severity level.
SID_HAL_LOG_WARNING#
#define SID_HAL_LOG_WARNINGValue:
(fmt_, ...)
Logs a warning message if the severity level is greater than or equal to the warning level.
SID_HAL_LOG_INFO#
#define SID_HAL_LOG_INFOValue:
(fmt_, ...)
Logs an informational message if the severity level is greater than or equal to the info level.
SID_HAL_LOG_DEBUG#
#define SID_HAL_LOG_DEBUGValue:
(fmt_, ...)
Logs a debug message if the severity level is greater than or equal to the debug level.
SID_HAL_LOG_FLUSH#
#define SID_HAL_LOG_FLUSHValue:
SID_PAL_LOG_FLUSH
Flushes the log buffer.
This macro calls the function to flush the log buffer.
SID_HAL_LOG_HEXDUMP_ERROR#
#define SID_HAL_LOG_HEXDUMP_ERRORValue:
(data_, len_)
Dumps a block of data in hexadecimal format with error severity.
SID_HAL_LOG_HEXDUMP_WARNING#
#define SID_HAL_LOG_HEXDUMP_WARNINGValue:
(data_, len_)
Dumps a block of data in hexadecimal format with warning severity.
SID_HAL_LOG_HEXDUMP_INFO#
#define SID_HAL_LOG_HEXDUMP_INFOValue:
(data_, len_)
Dumps a block of data in hexadecimal format with info severity.
SID_HAL_LOG_HEXDUMP_DEBUG#
#define SID_HAL_LOG_HEXDUMP_DEBUGValue:
(data_, len_)
Dumps a block of data in hexadecimal format with debug severity.