gko::log::EnableLogging#

CRTP convenience that combines Loggable with the type-erased dispatch used internally. Most users will not derive from this directly — every Ginkgo LinOp already inherits it transitively.

template<typename ConcreteLoggable, typename PolymorphicBase = Loggable>
class EnableLogging #

Inherits from

EnableLogging is a mixin which should be inherited by any class which wants to enable logging. All the received events are passed to the loggers this class contains.

Template Parameters:
  • ConcreteLoggable – the object being logged [CRTP parameter]

  • PolymorphicBase – the polymorphic base of this class. By default it is Loggable. Change it if you want to use a new superclass of Loggable as polymorphic base of this class.

Public Functions

inline virtual void add_logger(
std::shared_ptr<const Logger> logger,
) override#

Adds a new logger to the list of subscribed loggers.

Parameters:

logger – the logger to add

inline virtual void remove_logger(const Logger *logger) override#

Removes a logger from the list of subscribed loggers.

Note

The comparison is done using the logger’s object unique identity. Thus, two loggers constructed in the same way are not considered equal.

Parameters:

logger – the logger to remove

inline virtual const std::vector<std::shared_ptr<const Logger>> &get_loggers(
) const override#

Returns the vector containing all loggers registered at this object.

Returns:

the vector containing all registered loggers.

inline virtual void clear_loggers() override#

Remove all loggers registered at this object.