Fast DDS  Version 3.0.0
Fast DDS
Loading...
Searching...
No Matches

Logging utilities. More...

#include <Log.hpp>

Classes

struct  Context
 
struct  Entry
 

Public Types

enum  Kind { Error , Warning , Info }
 Types of log entry. More...
 

Static Public Member Functions

static FASTDDS_EXPORTED_API void RegisterConsumer (std::unique_ptr< LogConsumer > &&consumer)
 Registers an user defined consumer to route log output.
 
static FASTDDS_EXPORTED_API void ClearConsumers ()
 Removes all registered consumers, including the default stdout.
 
static FASTDDS_EXPORTED_API void ReportFilenames (bool)
 Enables the reporting of filenames in log entries. Disabled by default.
 
static FASTDDS_EXPORTED_API void ReportFunctions (bool)
 Enables the reporting of function names in log entries. Enabled by default when supported.
 
static FASTDDS_EXPORTED_API void SetVerbosity (Log::Kind)
 Sets the verbosity level, allowing for messages equal or under that priority to be logged.
 
static FASTDDS_EXPORTED_API Log::Kind GetVerbosity ()
 Returns the current verbosity level.
 
static FASTDDS_EXPORTED_API void SetCategoryFilter (const std::regex &)
 Sets a filter that will pattern-match against log categories, dropping any unmatched categories.
 
static FASTDDS_EXPORTED_API void UnsetCategoryFilter ()
 Unset the category filter.
 
static FASTDDS_EXPORTED_API bool HasCategoryFilter ()
 Returns whether a category filter was set or not.
 
static FASTDDS_EXPORTED_API std::regex GetCategoryFilter ()
 Returns a copy of the current category filter or an empty object otherwise.
 
static FASTDDS_EXPORTED_API void SetFilenameFilter (const std::regex &)
 Sets a filter that will pattern-match against filenames, dropping any unmatched categories.
 
static FASTDDS_EXPORTED_API std::regex GetFilenameFilter ()
 Returns a copy of the current filename filter or an empty object otherwise.
 
static FASTDDS_EXPORTED_API void SetErrorStringFilter (const std::regex &)
 Sets a filter that will pattern-match against the provided error string, dropping any unmatched categories.
 
static FASTDDS_EXPORTED_API void SetThreadConfig (const rtps::ThreadSettings &)
 Sets thread configuration for the logging thread.
 
static FASTDDS_EXPORTED_API std::regex GetErrorStringFilter ()
 Returns a copy of the current error string filter or an empty object otherwise.
 
static FASTDDS_EXPORTED_API void Reset ()
 Returns the logging engine to configuration defaults.
 
static FASTDDS_EXPORTED_API void Flush ()
 Waits until all info logged up to the call time is consumed.
 
static FASTDDS_EXPORTED_API void KillThread ()
 Stops the logging thread. It will re-launch on the next call to a successful log macro.
 
static FASTDDS_EXPORTED_API void QueueLog (const std::string &message, const Log::Context &, Log::Kind)
 Not recommended to call this method directly! Use the following macros:
 

Detailed Description

Logging utilities.

Logging is accessed through the three macros above, and configuration on the log output can be achieved through static methods on the class. Logging at various levels can be disabled dynamically (through the Verbosity level) or statically (through the LOG_NO_[VERB] macros) for maximum performance.

Member Enumeration Documentation

◆ Kind

enum Kind

Types of log entry.

  • Error: Maximum priority. Can only be disabled statically through LOG_NO_ERROR.
  • Warning: Medium priority. Can be disabled statically and dynamically.
  • Info: Low priority. Useful for debugging. Disabled by default on release branches.
Enumerator
Error 
Warning 
Info 

Member Function Documentation

◆ ClearConsumers()

static FASTDDS_EXPORTED_API void ClearConsumers ( )
static

Removes all registered consumers, including the default stdout.

◆ Flush()

static FASTDDS_EXPORTED_API void Flush ( )
static

Waits until all info logged up to the call time is consumed.

◆ GetCategoryFilter()

static FASTDDS_EXPORTED_API std::regex GetCategoryFilter ( )
static

Returns a copy of the current category filter or an empty object otherwise.

◆ GetErrorStringFilter()

static FASTDDS_EXPORTED_API std::regex GetErrorStringFilter ( )
static

Returns a copy of the current error string filter or an empty object otherwise.

◆ GetFilenameFilter()

static FASTDDS_EXPORTED_API std::regex GetFilenameFilter ( )
static

Returns a copy of the current filename filter or an empty object otherwise.

◆ GetVerbosity()

static FASTDDS_EXPORTED_API Log::Kind GetVerbosity ( )
static

Returns the current verbosity level.

◆ HasCategoryFilter()

static FASTDDS_EXPORTED_API bool HasCategoryFilter ( )
static

Returns whether a category filter was set or not.

◆ KillThread()

static FASTDDS_EXPORTED_API void KillThread ( )
static

Stops the logging thread. It will re-launch on the next call to a successful log macro.

◆ QueueLog()

static FASTDDS_EXPORTED_API void QueueLog ( const std::string &  message,
const Log::Context ,
Log::Kind   
)
static

Not recommended to call this method directly! Use the following macros:

  • EPROSIMA_LOG_INFO(cat, msg);
  • EPROSIMA_LOG_WARNING(cat, msg);
  • EPROSIMA_LOG_ERROR(cat, msg);

This is a very high sensible point of the code and it should be refactored to be as efficient as possible.

◆ RegisterConsumer()

static FASTDDS_EXPORTED_API void RegisterConsumer ( std::unique_ptr< LogConsumer > &&  consumer)
static

Registers an user defined consumer to route log output.

There is a default stdout consumer active as default.

Parameters
consumerr-value to a consumer unique_ptr. It will be invalidated after the call.

◆ ReportFilenames()

static FASTDDS_EXPORTED_API void ReportFilenames ( bool  )
static

Enables the reporting of filenames in log entries. Disabled by default.

◆ ReportFunctions()

static FASTDDS_EXPORTED_API void ReportFunctions ( bool  )
static

Enables the reporting of function names in log entries. Enabled by default when supported.

◆ Reset()

static FASTDDS_EXPORTED_API void Reset ( )
static

Returns the logging engine to configuration defaults.

◆ SetCategoryFilter()

static FASTDDS_EXPORTED_API void SetCategoryFilter ( const std::regex &  )
static

Sets a filter that will pattern-match against log categories, dropping any unmatched categories.

◆ SetErrorStringFilter()

static FASTDDS_EXPORTED_API void SetErrorStringFilter ( const std::regex &  )
static

Sets a filter that will pattern-match against the provided error string, dropping any unmatched categories.

◆ SetFilenameFilter()

static FASTDDS_EXPORTED_API void SetFilenameFilter ( const std::regex &  )
static

Sets a filter that will pattern-match against filenames, dropping any unmatched categories.

◆ SetThreadConfig()

static FASTDDS_EXPORTED_API void SetThreadConfig ( const rtps::ThreadSettings )
static

Sets thread configuration for the logging thread.

◆ SetVerbosity()

static FASTDDS_EXPORTED_API void SetVerbosity ( Log::Kind  )
static

Sets the verbosity level, allowing for messages equal or under that priority to be logged.

◆ UnsetCategoryFilter()

static FASTDDS_EXPORTED_API void UnsetCategoryFilter ( )
static

Unset the category filter.


The documentation for this class was generated from the following file: