logging.h
Functions
Name | |
---|---|
int | wolfSSL_SetLoggingCb(wolfSSL_Logging_cb log_function) This function registers a logging callback that will be used to handle the wolfSSL log message. By default, if the system supports it fprintf() to stderr is used but by using this function anything can be done by the user. |
int | wolfSSL_Debugging_ON(void ) If logging has been enabled at build time this function turns on logging at runtime. To enable logging at build time use –enable-debug or define DEBUG_WOLFSSL. |
void | wolfSSL_Debugging_OFF(void ) This function turns off runtime logging messages. If they’re already off, no action is taken. |
Functions Documentation
function wolfSSL_SetLoggingCb
int wolfSSL_SetLoggingCb(
wolfSSL_Logging_cb log_function
)
This function registers a logging callback that will be used to handle the wolfSSL log message. By default, if the system supports it fprintf() to stderr is used but by using this function anything can be done by the user.
Parameters:
- log_function function to register as a logging callback. Function signature must follow the above prototype.
See:
Return:
- Success If successful this function will return 0.
- BAD_FUNC_ARG is the error that will be returned if a function pointer is not provided.
Example
int ret = 0;
// Logging callback prototype
void MyLoggingCallback(const int logLevel, const char* const logMessage);
// Register the custom logging callback with wolfSSL
ret = wolfSSL_SetLoggingCb(MyLoggingCallback);
if (ret != 0) {
// failed to set logging callback
}
void MyLoggingCallback(const int logLevel, const char* const logMessage)
{
// custom logging function
}
function wolfSSL_Debugging_ON
int wolfSSL_Debugging_ON(
void
)
If logging has been enabled at build time this function turns on logging at runtime. To enable logging at build time use –enable-debug or define DEBUG_WOLFSSL.
Parameters:
- none No parameters.
See:
Return:
- 0 upon success.
- NOT_COMPILED_IN is the error that will be returned if logging isn’t enabled for this build.
Example
wolfSSL_Debugging_ON();
function wolfSSL_Debugging_OFF
void wolfSSL_Debugging_OFF(
void
)
This function turns off runtime logging messages. If they’re already off, no action is taken.
Parameters:
- none No parameters.
See:
Return: none No returns.
Example
wolfSSL_Debugging_OFF();
Source code
int wolfSSL_SetLoggingCb(wolfSSL_Logging_cb log_function);
int wolfSSL_Debugging_ON(void);
void wolfSSL_Debugging_OFF(void);
Updated on 2024-12-20 at 01:22:24 +0000