RTI Distributed Logger API  Version 6.1.2
RTI_DLDistLogger Class Reference

This class contains RTI Distributed Logger singleton and the methods to configure and use it. More...

Public Member Functions

DDS_ReturnCode_t setFilterLevel (DDS_Long newLevel)
 Sets the filter level for the singleton. More...
 
bool setRTILoggerPrintFormat (NDDS_Config_LogPrintFormat logPrintFormat)
 Sets PrintFormat of RTI Logger to the provided value. More...
 
void setRTILoggerVerbosityByCategory (NDDS_Config_LogCategory category, NDDS_Config_LogVerbosity verbosity)
 Updates the LogCategory and the LogVerbosity in RTI Logger to the provided value. More...
 
void logMessageWithLevelCategory (int logLevel, const char *message, const char *category)
 Logs a message at the specified level and with the specified category. More...
 
void logMessageWithParams (const struct RTI_DL_DistLogger_MessageParams &params)
 Performs the same function as logMessageWithLevelCategory except that it also allows specification of the message timestamp. More...
 
void fatal (const char *message)
 Logs a fatal message. More...
 
void severe (const char *message)
 Logs a severe message. More...
 
void error (const char *message)
 Logs a error message. More...
 
void warning (const char *message)
 Logs a warning message. More...
 
void notice (const char *message)
 Logs a notice message. More...
 
void info (const char *message)
 Logs a info message. More...
 
void debug (const char *message)
 Logs a debug message. More...
 
void trace (const char *message)
 Logs a trace message. More...
 
void log (int logLevel, const char *message)
 Logs a message. More...
 
void finalizeInstance ()
 Finalizes and delete the RTI_DL_DistLogger singleton. More...
 
DDS_Long getFatalLogLevel ()
 Return Fatal log level. More...
 
DDS_Long getErrorLogLevel ()
 Return Error log level. More...
 
DDS_Long getWarningLogLevel ()
 Return Warning log level. More...
 
DDS_Long getNoticeLogLevel ()
 Return Notice log level. More...
 
DDS_Long getInfoLogLevel ()
 Return Info log level. More...
 
DDS_Long getDebugLogLevel ()
 Return Debug log level. More...
 

Static Public Member Functions

static RTI_DLDistLoggergetInstance ()
 Provides access to the RTI_DL_DistLogger singleton. More...
 
static bool setOptions (RTI_DLOptions &options)
 Assigns configurable options to RTI Distributed Logger before its creation. More...
 

Detailed Description

This class contains RTI Distributed Logger singleton and the methods to configure and use it.

This class is a singleton, so only one copy will be created. Use the RTI_DLOptions class to customize the singleton BEFORE creating it.

Member Function Documentation

◆ getInstance()

static RTI_DLDistLogger* RTI_DLDistLogger::getInstance ( )
static

Provides access to the RTI_DL_DistLogger singleton.

This method provides access to the singleton instance of the RTI_DL_DistLogger. If the instance does not exist, it will be created. Note that no change in options is allowed after the singleton is created.

Returns
The singleton instance of the RTI_DL_DistLogger.

◆ setFilterLevel()

DDS_ReturnCode_t RTI_DLDistLogger::setFilterLevel ( DDS_Long  newLevel)

Sets the filter level for the singleton.

Filtering controls what type of log messages are sent. This enables filtering on the sending side (in the application using Distributed Logger). You can also enable filtering on the receiving side (such as in a tool that receives log messages, like RTI Admin Console or RTI Monitor).

Supported Filter Levels: See the table below. The default value is RTI_DL_INFO_LEVEL. The default value is RTI_DL_INFO_LEVEL.

Or see the IDL file provided with Distributed Logger (file: <RTI Connext Installation Folder>/resource/idl/distlog.idl).In the IDL file, there are language-specific bindings. Prepend the appropriate binding to the filter level shown in the IDL. For example, one of the filter levels in the IDL is INFO_LEVEL. To refer to this filter level in C++, use RTI_DL_INFO_LEVEL.

Log messages up to and including the specified filter level will pass through the filter and be sent on the network. For example, the WARNING level allows log messages up to and including the WARNING level (FATAL, SEVERE, ERROR, and WARNING) to be sent; any other log messages with numerically higher filter levels (INFO, DEBUG, and TRACE) will be filtered out and not sent.

Parameters
[in]newLevelThe new filter level.
Returns
Error code. DDS_RETCODE_OK if everything goes as planned.

The following table shows how RTI Connext DDS log levels map to RTI Distributed Logger log filter levels.

Not all RTI Distributed Logger levels appear in this table because there is not a one-to-one mapping between RTI Connext DDS and RTI Distributed Logger levels (there are more levels in RTI Distributed Logger). You can obtain the filter level using a constant defined in the Distributed Logger IDL file or a getter function in the Distributed Logger API.

Filter Levels
Connext DDS API constant Distributed Logger IDL constant Distributed Logger API getter
NDDS_CONFIG_LOG_FATAL_ERROR RTI_DL_FATAL_LEVEL getFatalLogLevel
NDDS_CONFIG_LOG_LEVEL_ERROR RTI_DL_ERROR_LEVEL getErrorLogLevel
NDDS_CONFIG_LOG_LEVEL_WARNING RTI_DL_WARNING_LEVEL getWarningLogLevel
NDDS_CONFIG_LOG_LEVEL_STATUS_LOCAL RTI_DL_NOTICE_LEVEL getNoticeLogLevel
NDDS_CONFIG_LOG_LEVEL_STATUS_REMOTE RTI_DL_INFO_LEVEL getInfoLogLevel
NDDS_CONFIG_LOG_LEVEL_DEBUG RTI_DL_DEBUG_LEVEL getDebugLogLevel

◆ setOptions()

static bool RTI_DLDistLogger::setOptions ( RTI_DLOptions options)
static

Assigns configurable options to RTI Distributed Logger before its creation.

Assigns the values in the options to the RTI_DLDistLogger singleton before its creation. If the singleton was already created, this function has no effect.

Parameters
[in]optionsThe new options to be assigned to the RTI_DLDistLogger singleton.
Precondition
The singleton must be NULL.
Returns
RTI_TRUE if everything went as planned. RTI_FALSE if RTI Distributed Logger already existed.

◆ setRTILoggerPrintFormat()

bool RTI_DLDistLogger::setRTILoggerPrintFormat ( NDDS_Config_LogPrintFormat  logPrintFormat)

Sets PrintFormat of RTI Logger to the provided value.

This method is mostly a pass-through to the appropriate call in RTI DDS library, but it also has the benefit of keeping the state of RTI Logger and RTI Distributed Logger in sync.

Parameters
[in]logPrintFormatThe new PrintFormat.
Returns
RTI_TRUE if everything went as planned.

◆ setRTILoggerVerbosityByCategory()

void RTI_DLDistLogger::setRTILoggerVerbosityByCategory ( NDDS_Config_LogCategory  category,
NDDS_Config_LogVerbosity  verbosity 
)

Updates the LogCategory and the LogVerbosity in RTI Logger to the provided value.

This method is mostly a pass-through to the appropriate call in RTI DDS library, but it also has the benefit of keeping the state of RTI Logger and RTI Distributed Logger in sync.

Parameters
[in]categoryThe category for which to set the verbosity.
[in]verbosityThe new verbosity level for the category.

◆ logMessageWithLevelCategory()

void RTI_DLDistLogger::logMessageWithLevelCategory ( int  logLevel,
const char *  message,
const char *  category 
)

Logs a message at the specified level and with the specified category.

Parameters
[in]logLevelThe level of the log message.
[in]messageThe message to log.
[in]categoryThe category of the log message.

◆ logMessageWithParams()

void RTI_DLDistLogger::logMessageWithParams ( const struct RTI_DL_DistLogger_MessageParams &  params)

Performs the same function as logMessageWithLevelCategory except that it also allows specification of the message timestamp.

Parameters
[in]paramsParameters.

◆ fatal()

void RTI_DLDistLogger::fatal ( const char *  message)

Logs a fatal message.

The message received is logged using the default category and the RTI_DL_FATAL_LEVEL log level.

Parameters
[in]messageThe message to log.

◆ severe()

void RTI_DLDistLogger::severe ( const char *  message)

Logs a severe message.

The message received is logged using the default category and the RTI_DL_SEVERE_LEVEL log level.

Parameters
[in]messageThe message to log.

◆ error()

void RTI_DLDistLogger::error ( const char *  message)

Logs a error message.

The message received is logged using the default category and the RTI_DL_ERROR_LEVEL log level.

Parameters
[in]messageThe message to log.

◆ warning()

void RTI_DLDistLogger::warning ( const char *  message)

Logs a warning message.

The message received is logged using the default category and the RTI_DL_WARNING_LEVEL log level.

Parameters
[in]messageThe message to log.

◆ notice()

void RTI_DLDistLogger::notice ( const char *  message)

Logs a notice message.

The message received is logged using the default category and the RTI_DL_NOTICE_LEVEL log level.

Parameters
[in]messageThe message to log.

◆ info()

void RTI_DLDistLogger::info ( const char *  message)

Logs a info message.

The message received is logged using the default category and the RTI_DL_INFO_LEVEL log level.

Parameters
[in]messageThe message to log.

◆ debug()

void RTI_DLDistLogger::debug ( const char *  message)

Logs a debug message.

The message received is logged using the default category and the RTI_DL_DEBUG_LEVEL log level.

Parameters
[in]messageThe message to log.

◆ trace()

void RTI_DLDistLogger::trace ( const char *  message)

Logs a trace message.

The message received is logged using the default category and the RTI_DL_TRACE_LEVEL log level.

Parameters
[in]messageThe message to log.

◆ log()

void RTI_DLDistLogger::log ( int  logLevel,
const char *  message 
)

Logs a message.

The message received is logged using the default category and the given log level.

Parameters
[in]logLevelThe level of the log message.
[in]messageThe message to log.

◆ finalizeInstance()

void RTI_DLDistLogger::finalizeInstance ( )

Finalizes and delete the RTI_DL_DistLogger singleton.

Unset the connections with DDS, frees memory and set singleton to NULL.

◆ getFatalLogLevel()

DDS_Long RTI_DLDistLogger::getFatalLogLevel ( )

Return Fatal log level.

Returns
Fatal log level.

◆ getErrorLogLevel()

DDS_Long RTI_DLDistLogger::getErrorLogLevel ( )

Return Error log level.

Returns
Error log level.

◆ getWarningLogLevel()

DDS_Long RTI_DLDistLogger::getWarningLogLevel ( )

Return Warning log level.

Returns
Warning log level.

◆ getNoticeLogLevel()

DDS_Long RTI_DLDistLogger::getNoticeLogLevel ( )

Return Notice log level.

Returns
Notice log level.

◆ getInfoLogLevel()

DDS_Long RTI_DLDistLogger::getInfoLogLevel ( )

Return Info log level.

Returns
Info log level.

◆ getDebugLogLevel()

DDS_Long RTI_DLDistLogger::getDebugLogLevel ( )

Return Debug log level.

Returns
Debug log level.