gko::log::Loggable#

Mixin that lets an object hold a list of loggers and dispatch events to them. Every LinOp, Executor, and stop::Criterion is Loggable — call add_logger(...) on any of them to start observing.

class Loggable#

Loggable class is an interface which should be implemented by classes wanting to support logging. For most cases, one can rely on the EnableLogging mixin which provides a default implementation of this interface.

Subclassed by

Public Functions

virtual void add_logger(std::shared_ptr<const Logger> logger) = 0#

Adds a new logger to the list of subscribed loggers.

Parameters:

logger – the logger to add

virtual void remove_logger(const Logger *logger) = 0#

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

virtual const std::vector<std::shared_ptr<const Logger>> &get_loggers(
) const = 0#

Returns the vector containing all loggers registered at this object.

Returns:

the vector containing all registered loggers.

virtual void clear_loggers() = 0#

Remove all loggers registered at this object.