gko::log::Record#
Captures every selected event into in-memory Data structs that you
can later inspect or assert against. The go-to logger for unit tests
that need to verify “operation X happened with arguments Y”.
-
class Record #
Inherits from
public gko::log::Logger
Record is a Logger which logs every event to an object. The object can then be accessed at any time by asking the logger to return it.
Note
Please note that this logger can have significant memory and performance overhead. In particular, when logging events such as the
checkevents, all parameters are cloned. If it is sufficient to clone one parameter, consider implementing a specific logger for this. In addition, it is advised to tune the history size in order to control memory overhead.Public Functions
-
inline const logged_data &get() const noexcept#
Returns the logged data
- Returns:
the logged data
Public Static Functions
- std::shared_ptr<const Executor> exec,
- const mask_type &enabled_events = Logger::all_events_mask,
- size_type max_storage = 1,
Creates a Record logger. This dynamically allocates the memory, constructs the object and returns an std::unique_ptr to this object.
- Parameters:
exec – the executor
enabled_events – the events enabled for this logger. By default all events.
max_storage – the size of storage (i.e. history) wanted by the user. By default 0 is used, which means unlimited storage. It is advised to control this to reduce memory overhead of this logger.
- Returns:
an std::unique_ptr to the the constructed object
- static inline std::unique_ptr<Record> create(
- const mask_type &enabled_events = Logger::all_events_mask,
- size_type max_storage = 1,
Creates a Record logger. This dynamically allocates the memory, constructs the object and returns an std::unique_ptr to this object.
- Parameters:
exec – the executor
enabled_events – the events enabled for this logger. By default all events.
max_storage – the size of storage (i.e. history) wanted by the user. By default 0 is used, which means unlimited storage. It is advised to control this to reduce memory overhead of this logger.
- Returns:
an std::unique_ptr to the the constructed object
-
struct logged_data#
Struct storing the actually logged data