1.3.2. Log

class eprosima::is::utils::Logger

Allows to easily log information into the standard output. It should be used as the preferred method for printing information within the whole Integration Service suite (core and SystemHandle).

Public Functions

Logger() = default

Default constructor.

Logger(const std::string &header)

Constructor.

Parameters
  • [in] header: The user-defined headed that will be printed at the beginning of every logger’s message.

Logger(const Logger&) = default

Copy constructor.

Logger(const Logger&&) = delete

Logger shall not be move constructible.

~Logger() = default

Destructor.

const Level &get_level() const

Get the maximum logging level for this Logger instance.

Return

A non-mutable reference to the maximum permitted logging level: DEBUG, INFO, WARN, ERROR.

Logger &operator<<(const Level &level)

Operator << overload for a certain logging Level. Sets the logging level for the char/string messages streamed afterwards, until std::endl is received.

Return

A reference to this object.

Parameters
  • [in] level: The logging Level of a new upcoming message.

Logger &operator<<(const char *message)

Operator << overload for a certain message.

Return

A reference to this object.

Parameters
  • [in] message: The message to be printed to stdout.

Logger &operator<<(const std::string &message)

Operator << overload for a certain message.

Return

A reference to this object.

Parameters
  • [in] message: The message to be printed to stdout.

template<typename T>
Logger &operator<<(const T &value)

Operator << overload for arithmetic types.

Return

A reference to this object.

Parameters
  • [in] value: A const reference to the numeric value.

Logger &operator<<(std::basic_ostream<char, std::char_traits<char>> &(*func)(std::basic_ostream<char, std::char_traits<char>>&))

Operator << overload for ostream function pointer. Useful for streaming special operations, such as std::endl.

Return

A reference to this object.

Parameters
  • [in] func: Pointer to std::ostream function.

class Level

Enumeration holding all the possible logging values. Messages logged with a logging priority level lower than the configured maximum level will not be displayed. This level is configurable via CMake parameters and can also be set using the provided set_logging_level method API.

class CurrentLevelStatus

Enumeration class which stores all the possible statuses for the current operation in the logger.