RTI Connext Modern C++ API  Version 6.1.0
rti::config::Logger Class Reference

The singleton type used to configure RTI Connext logging. More...

#include <rti/config/Logger.hpp>

Public Member Functions

Verbosity verbosity ()
 Get the verbosity at which RTI Connext is currently logging diagnostic information. More...
 
Verbosity verbosity_by_category (LogCategory category)
 Get the verbosity at which RTI Connext is currently logging diagnostic information in the given category. More...
 
void verbosity (Verbosity verbosity)
 Set the verbosity at which RTI Connext will log diagnostic information. More...
 
void verbosity_by_category (LogCategory category, Verbosity verbosity)
 Set the verbosity at which RTI Connext will log diagnostic information in the given category. More...
 
FILE * output_file ()
 Get the file to which the logged output is redirected. More...
 
void output_file (FILE *out)
 Set the file to which the logged output is redirected. More...
 
void output_file (const char *file_name)
 Set the name of the file to which the logged output is redirected. More...
 
void output_file_set (const char *file_preffix, const char *file_suffix, int max_bytes, int max_files=dds::core::LENGTH_UNLIMITED)
 Set the name of the file to which the logged output is redirected. More...
 
PrintFormat print_format ()
 Get the current message format for the log level LogLevel::EXCEPTION. More...
 
void print_format (PrintFormat print_format)
 Set the message format that RTI Connext will use to log diagnostic information for all the log levels, except for LogLevel::FATAL_ERROR. When the Activity Context is printed, the user can select the information that will be part of the Activity Context by using the API rti::config::activity_context::set_attribute_mask. More...
 
PrintFormat print_format_by_log_level (LogLevel log_level)
 Get the current message format, by log level, that RTI Connext is using to log diagnostic information. More...
 
void print_format_by_log_level (PrintFormat print_format, LogLevel log_level)
 Set the message format, by log level, that RTI Connext will use to log diagnostic information. When the Activity Context is printed, the user can select the information that will be part of the Activity Context by using the API rti::config::activity_context::set_attribute_mask. More...
 

Static Public Member Functions

static Loggerinstance ()
 Get the singleton instance of this type. More...
 

Detailed Description

The singleton type used to configure RTI Connext logging.

Member Function Documentation

◆ instance()

static Logger& rti::config::Logger::instance ( )
static

◆ verbosity() [1/2]

Verbosity rti::config::Logger::verbosity ( )

Get the verbosity at which RTI Connext is currently logging diagnostic information.

The default verbosity if Logger::verbosity is never called is rti::core::LogVerbosity::EXCEPTION.

If Logger::verbosity_by_category has been used to set different verbosities for different categories of messages, this method will return the maximum verbosity of all categories.

Examples:
Foo_publisher.cxx, and Foo_subscriber.cxx.

Referenced by rti::config::ScopedLoggerVerbosity::ScopedLoggerVerbosity(), and rti::config::ScopedLoggerVerbosity::~ScopedLoggerVerbosity().

◆ verbosity_by_category() [1/2]

Verbosity rti::config::Logger::verbosity_by_category ( LogCategory  category)

Get the verbosity at which RTI Connext is currently logging diagnostic information in the given category.

The default verbosity if Logger::verbosity and Logger::verbosity_by_category are never called is rti::core::LogVerbosity::EXCEPTION.

◆ verbosity() [2/2]

void rti::config::Logger::verbosity ( Verbosity  verbosity)

Set the verbosity at which RTI Connext will log diagnostic information.

Note: Logging at high verbosities will be detrimental to your application's performance. Your default setting should typically remain at rti::core::LogVerbosity::WARNING or below. (The default verbosity if you never set it is rti::core::LogVerbosity::EXCEPTION.)

◆ verbosity_by_category() [2/2]

void rti::config::Logger::verbosity_by_category ( LogCategory  category,
Verbosity  verbosity 
)

Set the verbosity at which RTI Connext will log diagnostic information in the given category.

◆ output_file() [1/3]

FILE* rti::config::Logger::output_file ( )

Get the file to which the logged output is redirected.

If no output file has been registered through Logger::set_output_file, this method will return NULL. In this case, logged output will on most platforms go to standard out as if through printf.

◆ output_file() [2/3]

void rti::config::Logger::output_file ( FILE *  out)

Set the file to which the logged output is redirected.

The file passed may be NULL, in which case further logged output will be redirected to the platform-specific default output location (standard out on most platforms).

For better performance when log messages are generated frequently, the log messages are not flushed into a file immediately after they are generated. In other words, while writing a log message, RTI Connext only calls the function fwrite() (see https://pubs.opengroup.org/onlinepubs/009695399/functions/fwrite.html); it does not call the function fflush() (see https://pubs.opengroup.org/onlinepubs/009695399/functions/fflush.html). If your application requires a different flushing behavior, you may use Logger::set_output_device to configure a custom logging device.

◆ output_file() [3/3]

void rti::config::Logger::output_file ( const char *  file_name)

Set the name of the file to which the logged output is redirected.

The name may be NULL, in which case further logged output will be redirected to the platform-specific default output location (standard out on most platforms).

See Logger::set_output_file for the flushing behavior.

◆ output_file_set()

void rti::config::Logger::output_file_set ( const char *  file_preffix,
const char *  file_suffix,
int  max_bytes,
int  max_files = dds::core::LENGTH_UNLIMITED 
)

Set the name of the file to which the logged output is redirected.

The name may be NULL, in which case further logged output will be redirected to the platform-specific default output location (standard out on most platforms).

See Logger::set_output_file for the flushing behavior.

◆ print_format() [1/2]

PrintFormat rti::config::Logger::print_format ( )

Get the current message format for the log level LogLevel::EXCEPTION.

Use Logger::get_print_format_by_log_level to retrieve the format for other log levels.

If Logger::set_print_format is never called, the default format is PrintFormat::DEFAULT.

◆ print_format() [2/2]

void rti::config::Logger::print_format ( PrintFormat  print_format)

Set the message format that RTI Connext will use to log diagnostic information for all the log levels, except for LogLevel::FATAL_ERROR. When the Activity Context is printed, the user can select the information that will be part of the Activity Context by using the API rti::config::activity_context::set_attribute_mask.

◆ print_format_by_log_level() [1/2]

PrintFormat rti::config::Logger::print_format_by_log_level ( LogLevel  log_level)

Get the current message format, by log level, that RTI Connext is using to log diagnostic information.

If Logger::set_print_format is never called, the default format is PrintFormat::DEFAULT.

◆ print_format_by_log_level() [2/2]

void rti::config::Logger::print_format_by_log_level ( PrintFormat  print_format,
LogLevel  log_level 
)

Set the message format, by log level, that RTI Connext will use to log diagnostic information. When the Activity Context is printed, the user can select the information that will be part of the Activity Context by using the API rti::config::activity_context::set_attribute_mask.