Logging API
Module: Utils API
Types
Name |
|
|---|---|
typedef void(*)(const char *str) |
Log_StringOutputType |
typedef void(*)(const char ch) |
Log_CharOutputType |
Defines
Name |
|
|---|---|
LOG_ERROR_NONE |
|
LOG_ERROR_NOT_INIT |
|
LOG_ERROR_INVALID_CB_FXN |
|
LOG_ERROR_INIT_FAILED |
|
LOG_ERROR_LOCK_FAILED |
|
LOG_INIT() |
|
LOG_REGISTER_OUTPUT(outputCb) |
|
LOG(format, …) |
|
LOG_CHAR(ch) |
|
LOG_ASSERT(cond, format, …) |
Types Documentation
typedef Log_StringOutputType
typedef void(* Log_StringOutputType) (const char *str);
Callback function to direct string log output to a user-defined console.
Parameters:
str string to be sent to the console
typedef Log_CharOutputType
typedef void(* Log_CharOutputType) (const char ch);
Callback function to direct single character log output to a user-defined console.
Parameters:
ch character to be sent to the console
Macros Documentation
define LOG_ERROR_NONE
#define LOG_ERROR_NONE (0)
No error.
define LOG_ERROR_NOT_INIT
#define LOG_ERROR_NOT_INIT (1)
Log module not initialized.
define LOG_ERROR_INVALID_CB_FXN
#define LOG_ERROR_INVALID_CB_FXN (2)
Invalid callback function, e.g. NULL handler.
define LOG_ERROR_INIT_FAILED
#define LOG_ERROR_INIT_FAILED (3)
Log module initialization failed.
define LOG_ERROR_LOCK_FAILED
#define LOG_ERROR_LOCK_FAILED (4)
Log module lock failed.
define LOG_INIT
#define LOG_INIT(
)
(void)0
Initializes the logging module.
This function sets up the logging module for use. It must be called before any other logging functions are used.
define LOG_REGISTER_OUTPUT
#define LOG_REGISTER_OUTPUT(
outputCb
)
(void)0
Registers a callback function for log output.
Parameters:
outputCb The callback function to handle log output
Return: [Log_ErrorType]
This API is not thread safe and recommended to be called during system initialization.
define LOG
#define LOG(
format,
...
)
(void)0
Outputs a message to the registered log output.
define LOG_CHAR
#define LOG_CHAR(
ch
)
(void)0
Outputs a character to the registered log output.
define LOG_ASSERT
#define LOG_ASSERT(
cond,
format,
...
)
if (!(cond)) \
{ \
while (1) \
; \
}
Assert check with Logs.