RTI Distributed Logger Modern C++ API Version 7.2.0
|
This class contains RTI Distributed Logger singleton and the methods to configure and use it. More...
#include <DistLogger.hpp>
Inherits dds::core::Reference< DistLoggerImpl >.
Public Member Functions | |
void | set_filter_level (int new_level) |
Sets the filter level for the singleton. More... | |
void | set_print_format (const rti::config::PrintFormat &log_format) |
Sets PrintFormat of RTI Logger to the provided value. More... | |
void | set_verbosity (const rti::config::LogCategory &category, const rti::config::Verbosity &verbosity) |
Updates the rti::config::LogCategory and the rti::config::Verbosity in RTI Logger to the provided value. More... | |
void | log_message (int log_level, const char *message, const char *category) |
Logs a message at the specified level and with the specified category. More... | |
void | log_message (int log_level, const std::string &message, const std::string &category) |
Logs a message at the specified level and with the specified category. More... | |
void | log_message (int log_level, const char *message, const char *category, const dds::core::Time ×tamp) |
Performs the same function as log_message(int, const std::string&, const std::string&) except that it also allows specification of the message timestamp. More... | |
void | log_message (int log_level, const std::string &message, const std::string &category, const dds::core::Time ×tamp) |
Performs the same function as log_message(int, const std::string&, const std::string&) except that it also allows specification of the message timestamp. More... | |
void | fatal (const char *message) |
Logs a fatal message. More... | |
void | fatal (const std::string &message) |
Logs a fatal message. More... | |
void | severe (const char *message) |
Logs a severe message. More... | |
void | severe (const std::string &message) |
Logs a severe message. More... | |
void | error (const char *message) |
Logs a error message. More... | |
void | error (const std::string &message) |
Logs a error message. More... | |
void | warning (const char *message) |
Logs a warning message. More... | |
void | warning (const std::string &message) |
Logs a warning message. More... | |
void | notice (const char *message) |
Logs a notice message. More... | |
void | notice (const std::string &message) |
Logs a notice message. More... | |
void | info (const char *message) |
Logs a info message. More... | |
void | info (const std::string &message) |
Logs a info message. More... | |
void | debug (const char *message) |
Logs a debug message. More... | |
void | debug (const std::string &message) |
Logs a debug message. More... | |
void | trace (const char *message) |
Logs a trace message. More... | |
void | trace (const std::string &message) |
Logs a trace message. More... | |
void | log (int log_level, const char *message) |
Logs a message. More... | |
void | log (int log_level, const std::string &message) |
Logs a message. More... | |
int | get_fatal_log_level () const |
Gets Fatal log level. More... | |
int | get_error_log_level () const |
Gets Error log level. More... | |
int | get_warning_log_level () const |
Gets Warning log level. More... | |
int | get_notice_log_level () const |
Gets Notice log level. More... | |
int | get_info_log_level () const |
Gets Info log level. More... | |
int | get_debug_log_level () const |
Gets Debug log level. More... | |
Static Public Member Functions | |
static DistLogger & | get_instance () |
Provides access to the DistLogger singleton. More... | |
static void | finalize () |
Finalizes the DistLogger singleton. More... | |
static void | set_options (const rti::dist_logger::DistLoggerOptions &options) |
Assigns configurable options to RTI Distributed Logger before its creation. More... | |
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 DistLoggerOptions class to customize the singleton BEFORE creating it.
|
static |
Provides access to the DistLogger singleton.
This method provides access to the singleton instance of the DistLogger. If the instance does not exist, it will be created. Note that no change in options is allowed after the singleton is created.
dds::core::Error | on failure. |
|
static |
Finalizes the DistLogger singleton.
This method must be called before the application ends.
dds::core::Exception | on failure. |
|
static |
Assigns configurable options to RTI Distributed Logger before its creation.
Assigns the values in the options
to the DistLogger singleton before its creation. If the singleton was already created, this method has no effect. If a Domain Participant is provided ih the options
, the Distributed Logger instance must be finalized before finalizing the Domain Participant Factory.
options | The new options to be assigned to the DistLogger singleton. |
dds::core::IllegalOperationError | when the DistLogger singleton has already been created or dds::core::Exception on failure setting the options. |
void rti::dist_logger::DistLogger::set_filter_level | ( | int | new_level | ) |
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.
new_level | The new filter level. |
dds::core::Exception | on failure. |
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.
Connext DDS API constant | Distributed Logger IDL constant | Distributed Logger API getter |
---|---|---|
rti::config::LogLevel::FATAL_ERROR | RTI_DL_FATAL_LEVEL | get_fatal_log_level |
rti::config::LogLevel::EXCEPTION | RTI_DL_ERROR_LEVEL | get_error_log_level |
rti::config::LogLevel::WARNING | RTI_DL_WARNING_LEVEL | get_warning_log_level |
rti::config::LogLevel::STATUS_LOCAL | RTI_DL_NOTICE_LEVEL | get_notice_log_level |
rti::config::LogLevel::STATUS_REMOTE | RTI_DL_INFO_LEVEL | get_info_log_level |
rti::config::LogLevel::STATUS_ALL | RTI_DL_DEBUG_LEVEL | get_debug_log_level |
void rti::dist_logger::DistLogger::set_print_format | ( | const rti::config::PrintFormat & | log_format | ) |
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.
log_format | The new PrintFormat. |
dds::core::Error | on failure. |
void rti::dist_logger::DistLogger::set_verbosity | ( | const rti::config::LogCategory & | category, |
const rti::config::Verbosity & | verbosity | ||
) |
Updates the rti::config::LogCategory and the rti::config::Verbosity 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.
category | The category for which to set the verbosity. |
verbosity | The new verbosity level for the category. |
dds::core::Error | on failure. |
void rti::dist_logger::DistLogger::log_message | ( | int | log_level, |
const char * | message, | ||
const char * | category | ||
) |
Logs a message at the specified level and with the specified category.
log_level | The level of the log message. |
message | The message to log. |
category | The category of the log message. |
void rti::dist_logger::DistLogger::log_message | ( | int | log_level, |
const std::string & | message, | ||
const std::string & | category | ||
) |
Logs a message at the specified level and with the specified category.
log_level | The level of the log message. |
message | The message to log. |
category | The category of the log message. |
void rti::dist_logger::DistLogger::log_message | ( | int | log_level, |
const char * | message, | ||
const char * | category, | ||
const dds::core::Time & | timestamp | ||
) |
Performs the same function as log_message(int, const std::string&, const std::string&) except that it also allows specification of the message timestamp.
log_level | The level of the log message. |
message | The message to log. |
category | The category of the log message. |
timestamp | The timestamp of the log message. |
void rti::dist_logger::DistLogger::log_message | ( | int | log_level, |
const std::string & | message, | ||
const std::string & | category, | ||
const dds::core::Time & | timestamp | ||
) |
Performs the same function as log_message(int, const std::string&, const std::string&) except that it also allows specification of the message timestamp.
log_level | The level of the log message. |
message | The message to log. |
category | The category of the log message. |
timestamp | The timestamp of the log message. |
void rti::dist_logger::DistLogger::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.
message | The message to log. |
void rti::dist_logger::DistLogger::fatal | ( | const std::string & | message | ) |
Logs a fatal message.
The message received is logged using the default category and the RTI_DL_FATAL_LEVEL log level.
message | The message to log. |
void rti::dist_logger::DistLogger::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.
message | The message to log. |
void rti::dist_logger::DistLogger::severe | ( | const std::string & | message | ) |
Logs a severe message.
The message received is logged using the default category and the RTI_DL_SEVERE_LEVEL log level.
message | The message to log. |
void rti::dist_logger::DistLogger::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.
message | The message to log. |
void rti::dist_logger::DistLogger::error | ( | const std::string & | message | ) |
Logs a error message.
The message received is logged using the default category and the RTI_DL_ERROR_LEVEL log level.
message | The message to log. |
void rti::dist_logger::DistLogger::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.
message | The message to log. |
void rti::dist_logger::DistLogger::warning | ( | const std::string & | message | ) |
Logs a warning message.
The message received is logged using the default category and the RTI_DL_WARNING_LEVEL log level.
message | The message to log. |
void rti::dist_logger::DistLogger::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.
message | The message to log. |
void rti::dist_logger::DistLogger::notice | ( | const std::string & | message | ) |
Logs a notice message.
The message received is logged using the default category and the RTI_DL_NOTICE_LEVEL log level.
message | The message to log. |
void rti::dist_logger::DistLogger::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.
message | The message to log. |
void rti::dist_logger::DistLogger::info | ( | const std::string & | message | ) |
Logs a info message.
The message received is logged using the default category and the RTI_DL_INFO_LEVEL log level.
message | The message to log. |
void rti::dist_logger::DistLogger::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.
message | The message to log. |
void rti::dist_logger::DistLogger::debug | ( | const std::string & | message | ) |
Logs a debug message.
The message received is logged using the default category and the RTI_DL_DEBUG_LEVEL log level.
message | The message to log. |
void rti::dist_logger::DistLogger::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.
message | The message to log. |
void rti::dist_logger::DistLogger::trace | ( | const std::string & | message | ) |
Logs a trace message.
The message received is logged using the default category and the RTI_DL_TRACE_LEVEL log level.
message | The message to log. |
void rti::dist_logger::DistLogger::log | ( | int | log_level, |
const char * | message | ||
) |
Logs a message.
The message received is logged using the default category and the given log level.
log_level | The level of the log message. |
message | The message to log. |
void rti::dist_logger::DistLogger::log | ( | int | log_level, |
const std::string & | message | ||
) |
Logs a message.
The message received is logged using the default category and the given log level.
log_level | The level of the log message. |
message | The message to log. |
int rti::dist_logger::DistLogger::get_fatal_log_level | ( | ) | const |
Gets Fatal log level.
This method returns the currently defined value for RTI_DL_FATAL_LEVEL defined in <RTI Connext Installation Folder>/resource/idl/distlog.idl
int rti::dist_logger::DistLogger::get_error_log_level | ( | ) | const |
Gets Error log level.
This method returns the currently defined value for RTI_DL_ERROR_LEVEL defined in <RTI Connext Installation Folder>/resource/idl/distlog.idl
int rti::dist_logger::DistLogger::get_warning_log_level | ( | ) | const |
Gets Warning log level.
This method returns the currently defined value for RTI_DL_WARNING_LEVEL defined in <RTI Connext Installation Folder>/resource/idl/distlog.idl
int rti::dist_logger::DistLogger::get_notice_log_level | ( | ) | const |
Gets Notice log level.
This method returns the currently defined value for RTI_DL_NOTICE_LEVEL defined in <RTI Connext Installation Folder>/resource/idl/distlog.idl
int rti::dist_logger::DistLogger::get_info_log_level | ( | ) | const |
Gets Info log level.
This method returns the currently defined value for RTI_DL_INFO_LEVEL defined in <RTI Connext Installation Folder>/resource/idl/distlog.idl
int rti::dist_logger::DistLogger::get_debug_log_level | ( | ) | const |
Gets Debug log level.
This method returns the currently defined value for RTI_DL_DEBUG_LEVEL defined in <RTI Connext Installation Folder>/resource/idl/distlog.idl