Distributed Logger API  Version 1.6b [build 01]
RTI_DLDistLogger Class Reference

This class contains the Distributed Logger (DL) and the methods to 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 the RTI Logger.
 
void setRTILoggerVerbosityByCategory (NDDS_Config_LogCategory category, NDDS_Config_LogVerbosity verbosity)
 Updates the LogCategory and the LogVerbosity in the RTI Logger.
 
void logMessageWithLevelCategory (int logLevel, const char *message, const char *category)
 Logs a message at the specified level and with the specified category.
 
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)
 Sets the default options for the RTI_DL_DistLogger.
 

Detailed Description

This class contains the Distributed Logger (DL) and the methods to to configure and use 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: ndds.<version>/resource/rtidistlogger/idl/rtidistlog.idl). The default value is RTI_DL_TRACE_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 Connext log levels map to Distributed Logger log filter levels. Not all Distributed Logger levels appear in this table because there is not a one-to-one mapping between Connext and Distributed Logger levels (there are more levels in Distributed Logger).

Filter Levels
Connext 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

Sets the default options for the RTI_DL_DistLogger.

Sets the RTI_DL_Options for the singleton.

Parameters
[in]optionsThe new options.
Precondition
self must be NULL.
Returns
RTI_TRUE if everything went as planned.
bool RTI_DLDistLogger::setRTILoggerPrintFormat ( NDDS_Config_LogPrintFormat  logPrintFormat)

Sets PrintFormat of the RTI Logger.

Modifies the RTI Logger PrintFormat to match logPrintFormat.

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 the RTI Logger.

This method is mostly a pass-through to the appropriate call in the RTI DDS library but it also has the benefit of keeping the state of the logger in synch with this setting in the library (there is no other way to do so).

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::fatal ( const char *  message)

Logs a fatal message.

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

Parameters
[in]messageThe message to log.
void RTI_DLDistLogger::severe ( const char *  message)

Logs a severe message.

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

Parameters
[in]messageThe message to log.
void RTI_DLDistLogger::error ( const char *  message)

Logs a error message.

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

Parameters
[in]messageThe message to log.
void RTI_DLDistLogger::warning ( const char *  message)

Logs a warning message.

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

Parameters
[in]messageThe message to log.
void RTI_DLDistLogger::notice ( const char *  message)

Logs a notice message.

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

Parameters
[in]messageThe message to log.
void RTI_DLDistLogger::info ( const char *  message)

Logs a info message.

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

Parameters
[in]messageThe message to log.
void RTI_DLDistLogger::debug ( const char *  message)

Logs a debug message.

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

Parameters
[in]messageThe message to log.
void RTI_DLDistLogger::trace ( const char *  message)

Logs a trace message.

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

Parameters
[in]messageThe message to log.
void RTI_DLDistLogger::log ( int  logLevel,
const char *  message 
)

Logs a message.

The message recieved 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.

Distributed Logger API Version 1.6b [build 01] Copyright © Tue Feb 4 2014 Real-Time Innovations, Inc