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.c File Reference

This file contains the definitions of the functions that comprise the CDI Core SDK's API. More...

#include "cdi_log_api.h"
#include <assert.h>
#include <stdio.h>
#include <stdarg.h>
#include "configuration.h"
#include "cdi_logger_api.h"
#include "cdi_os_api.h"
#include "internal.h"

Functions

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

Detailed Description

This file contains the definitions of the functions that comprise the CDI Core SDK's API.

Function Documentation

◆ CdiLogComponentEnable()

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()

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()

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()

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()

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()

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()

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.