RTI Distributed Logger API  Version 6.0.0
 All Classes Functions Typedefs Groups
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.
 
bool setRTILoggerPrintFormat (NDDS_Config_LogPrintFormat logPrintFormat)
 Sets PrintFormat of RTI Logger to the provided value.
 
void setRTILoggerVerbosityByCategory (NDDS_Config_LogCategory category, NDDS_Config_LogVerbosity verbosity)
 Updates the LogCategory and the LogVerbosity in RTI Logger to the provided value.
 
void logMessageWithLevelCategory (int logLevel, const char *message, const char *category)
 Logs a message at the specified level and with the specified category.
 
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.
 
void fatal (const char *message)
 Logs a fatal message.
 
void severe (const char *message)
 Logs a severe message.
 
void error (const char *message)
 Logs a error message.
 
void warning (const char *message)
 Logs a warning message.
 
void notice (const char *message)
 Logs a notice message.
 
void info (const char *message)
 Logs a info message.
 
void debug (const char *message)
 Logs a debug message.
 
void trace (const char *message)
 Logs a trace message.
 
void log (int logLevel, const char *message)
 Logs a message.
 
void finalizeInstance ()
 Finalizes and delete the RTI_DL_DistLogger singleton.
 

Static Public Member Functions

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

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

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.
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 IDL file provided with Distributed Logger (file: <RTI Connext Installation Folder>/resource/idl/distlog.idl).). The default value is RTI_DL_INFO_LEVEL.

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

Filter Levels
Connext DDS Distributed Logger
NDDS_CONFIG_LOG_LEVEL_ERROR RTI_DL_ERROR_LEVEL
NDDS_CONFIG_LOG_LEVEL_WARNING RTI_DL_WARNING_LEVEL
NDDS_CONFIG_LOG_LEVEL_STATUS_LOCAL RTI_DL_NOTICE_LEVEL
NDDS_CONFIG_LOG_LEVEL_STATUS_REMOTE RTI_DL_INFO_LEVEL
NDDS_CONFIG_LOG_LEVEL_DEBUG RTI_DL_DEBUG_LEVEL
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
void RTI_DLDistLogger::finalizeInstance ( )

Finalizes and delete the RTI_DL_DistLogger singleton.

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

Returns
Code error. DDS_RETCODE_OK if everything went as planned.

RTI Distributed Logger API Version 6.0.0 Copyright © Sun Mar 3 2019 Real-Time Innovations, Inc