RTI Connext .Net APIs  Version 5.3.0
NDDS::ConfigLogger Class Reference

<<interface>> The singleton type used to configure RTI Connext logging. More...

#include <managed_config_dotnet.h>

Public Member Functions

LogVerbosity get_verbosity ()
 Get the verbosity at which RTI Connext is currently logging diagnostic information. More...
 
LogVerbosity get_verbosity_by_category (LogCategory category)
 Get the verbosity at which RTI Connext is currently logging diagnostic information in the given category. More...
 
void set_verbosity (LogVerbosity verbosity)
 Set the verbosity at which RTI Connext will log diagnostic information. More...
 
void set_verbosity_by_category (LogCategory category, LogVerbosity verbosity)
 Set the verbosity at which RTI Connext will log diagnostic information in the given category. More...
 
System::Boolean set_output_device (LoggerDevice^ outDevice)
 Register a NDDS::LoggerDevice. More...
 
System::Boolean set_output_file_set (System::String^ file_prefix, System::String^ file_suffix, System::Int32 max_capacity, System::Int32 max_files)
 Configure a set of files to redirect the logged output. More...
 
LogPrintFormat get_print_format ()
 Get the current message format that RTI Connext is using to log diagnostic information. More...
 
System::Boolean set_print_format (LogPrintFormat print_format)
 Set the message format that RTI Connext will use to log diagnostic information. More...
 

Static Public Member Functions

static ConfigLoggerget_instance ()
 Get the singleton instance of this type. More...
 
static void set_log_delegate (LogCallbackDelegate^ cb)
 Install a custom callback for logging. More...
 
static LogCallbackDelegate ^ get_log_delegate ()
 Get the custom logging callback, if any has been installed. More...
 

Detailed Description

<<interface>> The singleton type used to configure RTI Connext logging.

Member Function Documentation

◆ get_instance()

static ConfigLogger ^ NDDS::ConfigLogger::get_instance ( )
inlinestatic

Get the singleton instance of this type.

◆ get_verbosity()

LogVerbosity NDDS::ConfigLogger::get_verbosity ( )

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

The default verbosity if NDDS::ConfigLogger::set_verbosity is never called is NDDS::LogVerbosity::NDDS_CONFIG_LOG_VERBOSITY_ERROR.

If NDDS::ConfigLogger::set_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.

◆ get_verbosity_by_category()

LogVerbosity NDDS::ConfigLogger::get_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 NDDS::ConfigLogger::set_verbosity and NDDS::ConfigLogger::set_verbosity_by_category are never called is NDDS::LogVerbosity::NDDS_CONFIG_LOG_VERBOSITY_ERROR.

◆ set_verbosity()

void NDDS::ConfigLogger::set_verbosity ( LogVerbosity  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 NDDS::LogVerbosity::NDDS_CONFIG_LOG_VERBOSITY_WARNING or below. (The default verbosity if you never set it is NDDS::LogVerbosity::NDDS_CONFIG_LOG_VERBOSITY_ERROR.)

◆ set_verbosity_by_category()

void NDDS::ConfigLogger::set_verbosity_by_category ( LogCategory  category,
LogVerbosity  verbosity 
)

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

◆ set_output_device()

System::Boolean NDDS::ConfigLogger::set_output_device ( LoggerDevice outDevice)

Register a NDDS::LoggerDevice.

Register the specified logging device with the logger.

There can be at most only one device registered with the logger at any given time.

When a device is installed, the logger will stop sending the log messages to the standard output and to the file set with NDDS::ConfigLogger::set_output_file_set.

To remove an existing device, use this method with NULL as the device parameter. After a device is removed the logger will continue sending log messages to the standard output and to the output file.

To replace an existing device with a new device, use this method providing the new device as the device parameter.

When a device is unregistered (by setting it to NULL), NDDS::LoggerDevice calls the method NDDS::LoggerDevice::close.

Parameters
outDevice<<in>> Logging device.

◆ set_output_file_set()

System::Boolean NDDS::ConfigLogger::set_output_file_set ( System::String^  file_prefix,
System::String^  file_suffix,
System::Int32  max_capacity,
System::Int32  max_files 
)

Configure a set of files to redirect the logged output.

The logged output will be redirected to a set of files whose names are configured with a prefix and a suffix. The maximum number of bytes configures how many bytes to write into a file before opening the next file. After reaching the maximum number of files, the first one is overwritten.

For example, if the prefix is 'Foo', the suffix is '.txt', the max number of bytes is 1GB, and the max number of files is 3, the logger will create (at most) these files: Foo1.txt, Foo2.txt, and Foo3.txt. It will write to Foo1.txt, and after writing 1GB, it will move on to Foo2.txt, then to Foo3.txt, then to Foo1.txt again, and so on.

To stop logging to these files and redirect the output to the platform-specific location, pass NULL, NULL, 0, 0.

◆ get_print_format()

LogPrintFormat NDDS::ConfigLogger::get_print_format ( )

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

If NDDS::ConfigLogger::set_print_format is never called, the default format is NDDS::LogPrintFormat::NDDS_CONFIG_LOG_PRINT_FORMAT_DEFAULT.

◆ set_print_format()

System::Boolean NDDS::ConfigLogger::set_print_format ( LogPrintFormat  print_format)

Set the message format that RTI Connext will use to log diagnostic information.

If you use NDDS::ConfigLogger::set_log_delegate(), you cannot also use set_print_format(). You must use NDDS::LogPrintFormat::NDDS_CONFIG_LOG_PRINT_FORMAT_DEFAULT.

◆ set_log_delegate()

static void NDDS::ConfigLogger::set_log_delegate ( LogCallbackDelegate^  cb)
static

Install a custom callback for logging.

Custom log delegates are not compatible with the advanced logging information enabled by NDDS::ConfigLogger::set_print_format.

See also
NDDS::ConfigLogger::get_log_delegate
NDDS::LogCallbackDelegate()

For example:

public class MyLogger
{
public static int MyLoggerCallback(string msg)
{
System.Console.Write("MyLoggerCallback: " + msg);
return 0;
}
}
...
NDDS.ConfigLogger.set_log_delegate(MyLogger.MyLoggerCallback);

◆ get_log_delegate()

static LogCallbackDelegate ^ NDDS::ConfigLogger::get_log_delegate ( )
static

Get the custom logging callback, if any has been installed.

See also
NDDS::ConfigLogger::set_log_delegate
NDDS::LogCallbackDelegate()

RTI Connext .Net APIs Version 5.3.0 Copyright © Sun Jun 25 2017 Real-Time Innovations, Inc