CDI SDK
SDK for transporting chunks of data reliably and with low latency using a polled mode network driver.
Loading...
Searching...
No Matches
cdi_log_api.h File Reference

This file declares the public API data types, structures and functions that comprise the CDI log API. More...

#include "cdi_core_api.h"
#include "cdi_log_enums.h"
#include <stdbool.h>

Go to the source code of this file.

Data Structures

struct  CdiLogCallbackData
 This defines a structure that contains the information used to configure a callback log, referred to using the enumerated value kLogMethodCallback. More...
 
struct  CdiLogMethodData
 A structure of this type is used to configure the type of log method that is being used. It is passed as the parameter to CdiCoreInitialize() and as part of the CdiTxConfigData or CdiRxConfigData configuration data passed to the Cdi...TxCreate() API functions. More...
 
struct  CdiLogMessageCbData
 A structure of this type is passed as the parameter to CdiLogMessageCallback(). It contains a single log message generated by the SDK. More...
 

Typedefs

typedef void * CdiUserCbParameter
 Forward declaration to create pointer to callback parameter when used.
 
typedef struct CdiLogMessageCbData CdiLogMessageCbData
 Forward declaration to create pointer to log message callback data when used.
 
typedef void(* CdiLogMessageCallback) (const CdiLogMessageCbData *cb_data_ptr)
 Forward declaration to create pointer to callback function when used.
 
typedef struct CdiConnectionStateCdiConnectionHandle
 Forward declaration to create pointer to connection when used.
 
typedef struct CdiLogStateCdiLogHandle
 Forward declaration to create pointer to log handle.
 
typedef struct CdiLogCallbackData CdiLogCallbackData
 Forward declaration to create pointer to callback data when used.
 
typedef struct CdiLogMethodData CdiLogMethodData
 Forward declaration to create pointer to method data when used.
 

Functions

CDI_INTERFACE CdiReturnStatus CdiLogComponentEnable (CdiConnectionHandle handle, CdiLogComponent component, bool enable)
 
CDI_INTERFACE CdiReturnStatus CdiLogComponentEnableGlobal (CdiLogComponent component, bool enable)
 
CDI_INTERFACE bool CdiLogComponentIsEnabled (CdiConnectionHandle handle, CdiLogComponent component)
 
CDI_INTERFACE CdiReturnStatus CdiLogLevelSet (CdiConnectionHandle handle, CdiLogComponent component, CdiLogLevel level)
 
CDI_INTERFACE CdiReturnStatus CdiLogLevelSetGlobal (CdiLogComponent component, CdiLogLevel level)
 
CDI_INTERFACE CdiReturnStatus CdiLogStderrEnable (bool enable, CdiLogLevel level)
 
CDI_INTERFACE CdiLogHandle CdiLogGlobalGet (void)
 

Detailed Description

This file declares the public API data types, structures and functions that comprise the CDI log API.

Typedef Documentation

◆ CdiLogMessageCallback

typedef void(* CdiLogMessageCallback)(const CdiLogMessageCbData *cb_data_ptr)

Forward declaration to create pointer to callback function when used.

Prototype of log message callback function. The user code can optionally implement a function with this prototype, and provide it as part of the CdiTxConfigData or CdiRxConfigData that is passed to one of the Cdi...Create() functions.

This callback function is invoked whenever a log message is generated. Control of which log components are enabled is set using CdiLogComponentEnable(). Log levels are set using CdiLogLevelSet().

Parameters
cb_data_ptrA pointer to an CdiLogMessageCbData structure.

Function Documentation

◆ CdiLogComponentEnable()

CDI_INTERFACE CdiReturnStatus CdiLogComponentEnable ( CdiConnectionHandle handle,
CdiLogComponent component,
bool enable )

Enable or disable specific log component messages for a specific connection or the global logger. All components are disabled by default.

Parameters
handleConnection handle returned by Cdi...TxCreate() API functions. If NULL, then the global logger is used.
componentType of component to enable/disable log message generation.
enableTrue to enable, False to disable.
Returns
A value from the CdiReturnStatus enumeration.

◆ CdiLogComponentEnableGlobal()

CDI_INTERFACE CdiReturnStatus CdiLogComponentEnableGlobal ( CdiLogComponent component,
bool enable )

Enable or disable specific log component messages globally for all logs. All components are disabled by default.

Parameters
componentType of component to enable/disable log message generation.
enableTo enable use true, otherwise use false.
Returns
A value from the CdiReturnStatus enumeration.

◆ CdiLogComponentIsEnabled()

CDI_INTERFACE bool CdiLogComponentIsEnabled ( CdiConnectionHandle handle,
CdiLogComponent component )

Determine if a component is enabled for logging for a specific connection or the global logger.

Parameters
handleConnection handle returned by Cdi...TxCreate() API functions. If NULL, then the global logger is used.
componentType of component to check.
Returns
True if enabled, otherwise false.

◆ CdiLogGlobalGet()

CDI_INTERFACE CdiLogHandle CdiLogGlobalGet ( void )

Get the handle to the global log set by the CdiCoreInitialize() API.

Returns
Handle of global log. If the CdiCoreInitialize() API has not been used, NULL is returned.

◆ CdiLogLevelSet()

CDI_INTERFACE CdiReturnStatus CdiLogLevelSet ( CdiConnectionHandle handle,
CdiLogComponent component,
CdiLogLevel level )

Set log level for a component for a specific connection or the global logger. Log messages of the specified level or lower are generated. The default log level is set to kLogInfo.

Parameters
handleConnection handle returned by Cdi...TxCreate() API functions. If NULL, then the global logger is used.
componentType of component to set log level.
levelLog level to set.
Returns
A value from the CdiReturnStatus enumeration.

◆ CdiLogLevelSetGlobal()

CDI_INTERFACE CdiReturnStatus CdiLogLevelSetGlobal ( CdiLogComponent component,
CdiLogLevel level )

Set log level for a component for all logs. Log messages of the specified level or lower are generated. The default log level is set to kLogInfo.

Parameters
componentType of component to set log level.
levelLog level to set.
Returns
A value from the CdiReturnStatus enumeration.

◆ CdiLogStderrEnable()

CDI_INTERFACE CdiReturnStatus CdiLogStderrEnable ( bool enable,
CdiLogLevel level )

Send log messages to stderr in addition to log files, if log files are enabled.

Parameters
enableUse true to enable, false to disable.
levelLog level to enable output to stderr.
Returns
A value from the CdiReturnStatus enumeration.