Log Management
This is the header file for "psdk_logger.c", defining the structure and (exported) function prototypes.
Catalog
Define Enum and Structure
ConsoleFunc
E_PsdkLoggerConsoleLogLevel
T_PsdkLoggerConsoleFunction
PsdkLogger_AddConsole
PsdkLogger_UserLogInfo
PsdkLogger_UserLogWarn
PsdkLogger_UserLogDebug
PsdkLogger_UserLogError
Define Enum and Structure
typedef function ConsoleFunc
Function:Register the console method | product:all |
The console method that needs to be registered.
NOTE Before registering the console method, you need to test the methods that need to be registered to ensure that they can be used normally.
typedef T_PsdkReturnCode (*ConsoleFunc)(const uint8_t *data, uint16_t dataLen);
typedef enum E_PsdkLoggerConsoleLogLevel
The type of the log level
typedef enum {
PSDK_LOGGER_CONSOLE_LOG_LEVEL_ERROR = 1, Logger console error level. The method and level of the console are
associated with each other. If the level of the registered console
method is lower than this level, the level interface will not be
printed successfully.
PSDK_LOGGER_CONSOLE_LOG_LEVEL_WARNING = 2, Logger console warning level.The method and level of the console are
associated with each other. If the level of the registered console
method is lower than this level, the level interface will not be
printed successfully.
PSDK_LOGGER_CONSOLE_LOG_LEVEL_INFO = 3, Logger console info level. The method and level of the console are
associated with each other. If the level of the registered console
method is lower than this level, the level interface will not be
printed successfully.
PSDK_LOGGER_CONSOLE_LOG_LEVEL_DEBUG = 4, Logger console debug level. The method and level of the console are
associated with each other. If the level of the registered console
method is lower than this level, the level interface will not be
printed successfully.
} E_PsdkLoggerConsoleLogLevel;
typedef struct E_PsdkLoggerConsoleLogLevel
The level of the log
typedef struct {
uint8_t consoleLevel; Specifies logger console level. The method and level of the console are associated with
each other. Calling different levels of the print interface, you can print the log with
the method no higher than the level. For example, the registered method level is info,
only the log not higher than info can be printed, and the debug log will not be printed.
ConsoleFunc func; Specifies logger console function. Before registering the console method, you need to
test the methods that need to be registered to ensure that they can be used normally.
} T_PsdkLoggerConsole;
Function
function PsdkLogger_AddConsole
Function:Add the console function and level | product:all |
Add the console function and level for Payload SDK.
NOTE When registering the console, you need to provide the method of the console and the level corresponding to the method. Log levels from high to low are Debug, Info, Warn, and Error, the log function module can print all logs not higher than the specified level. Maximum support for registering eight different console methods at the same time.Before registering the console method, you should test the registration method ensure that all the method are normally. If you registered multiple methods at the same time, all the methods will be print.
T_PsdkReturnCode PsdkLogger_AddConsole(T_PsdkLoggerConsole *console);
console:pointer to the console function.
Return
The details for the return code please refer to:PsdkErrorCode
function PsdkLogger_UserLogInfo
Function:Print out the info log | product:all |
Print out the info log of the specified format by the registration method.
void PsdkLogger_UserLogInfo(const char *fmt, ...);
fmt:pointer to the format string that needs print out.
...:Variable parameters, consistent with the use of the system interface print out.
Return
The details for the return code please refer to:PsdkErrorCode
function PsdkLogger_UserLogWarn
Function:Print out the warning log | product:all |
Print out the warning log of the specified format by the registration method.
void PsdkLogger_UserLogWarn(const char *fmt, ...);
fmt:pointer to the format string that needs print out.
...:Variable parameters, consistent with the use of the system interface print out.
Return
The details for the return code please refer to:PsdkErrorCode
function PsdkLogger_UserLogDebug
Function:rint out the debug log | product:all |
Print out the debug log of the specified format by the registration method.
void PsdkLogger_UserLogDebug(const char *fmt, ...);
fmt:pointer to the format string that needs print out.
...:Variable parameters, consistent with the use of the system interface print out.
Return
The details for the return code please refer to:PsdkErrorCode
function PsdkLogger_UserLogError
Function:Print out the error log | product:all |
Print out the error log of the specified format by the registration method.
void PsdkLogger_UserLogError(const char *fmt, ...);
fmt:pointer to the format string that needs print out.
...:Variable parameters, consistent with the use of the system interface print out.
Return
The details for the return code please refer to:PsdkErrorCode