Class Acts::Logger

class Logger

class for printing debug output

This class provides the user interface for printing debug messages with different levels of severity.

Public Functions

inline Logger(std::unique_ptr<Logging::OutputPrintPolicy> pPrint, std::unique_ptr<Logging::OutputFilterPolicy> pFilter)

construct from output print and filter policy

Parameters
  • pPrint[in] policy for printing debug messages

  • pFilter[in] policy for filtering debug messages

inline std::unique_ptr<Logger> clone(const std::optional<std::string> &_name = std::nullopt, const std::optional<Logging::Level> &_level = std::nullopt) const

Make a copy of this logger, optionally changing the name or the level.

Parameters
  • _name – the optional new name

  • _level – the optional new level

inline std::unique_ptr<Logger> clone(Logging::Level _level) const

Make a copy of the logger, with a new level.

Convenience function for if you only want to change the level but not the name.

Parameters

_level – the new level

Returns

the new logger

inline std::unique_ptr<Logger> cloneWithSuffix(const std::string &suffix, std::optional<Logging::Level> _level = std::nullopt) const

Make a copy of the logger, with a suffix added to the end of it’s name.

You can also optionally supply a new level

Parameters
  • suffix – the suffix to add to the end of the name

  • _level – the optional new level

inline bool doPrint(const Logging::Level &lvl) const

decide whether a message with a given debug level has to be printed

Parameters

lvl[in] debug level of debug message

Returns

true if debug message should be printed, otherwise false

inline const Logging::OutputFilterPolicy &filterPolicy() const

Return the filter policy for this logger.

Returns

the filter policy

inline Logging::Level level() const

Return the level of the filter policy of this logger.

Returns

the level

inline void log(const Logging::Level &lvl, const std::string &input) const

log a debug message

Parameters
  • lvl[in] debug level of debug message

  • input[in] text of debug message

inline const std::string &name() const

Return the name of the print policy of thi logger.

Returns

the name

inline const Logger &operator()() const

Helper function so a logger reference can be used as is with the logging macros.

inline const Logging::OutputPrintPolicy &printPolicy() const

Return the print policy for this logger.

Returns

the print policy