![]() |
LogIt++
Header-only, macro-first C++ logging library
|
Optional interface for backends that can notify callers when a record is successfully written. More...
#include <ILogSubscriber.hpp>
Public Types | |
| using | Callback = std::function<void(const LogRecordSnapshot&)> |
Public Member Functions | |
| virtual | ~ILogSubscriber ()=default |
| virtual uint64_t | add_log_callback (Callback callback)=0 |
| Registers a callback to be invoked after each successfully written record. | |
| virtual bool | remove_log_callback (uint64_t callback_id)=0 |
| Unregisters a previously added callback. | |
Optional interface for backends that can notify callers when a record is successfully written.
Callbacks receive a LogRecordSnapshot containing the persisted preview and metadata. String fields inside the snapshot are owned copies and may be stored by value. Callbacks are invoked in registration order after the record has been committed to storage. Implementations must not hold internal locks while invoking callbacks.
Definition at line 21 of file ILogSubscriber.hpp.
| using logit::ILogSubscriber::Callback = std::function<void(const LogRecordSnapshot&)> |
Definition at line 23 of file ILogSubscriber.hpp.
|
virtualdefault |
|
pure virtual |
Registers a callback to be invoked after each successfully written record.
| callback | Function called with the written LogRecordSnapshot. |
Implemented in logit::MdbxLogger, and logit::MemoryLogger.
|
pure virtual |
Unregisters a previously added callback.
Removal prevents future dispatch snapshots from including the callback, but cannot cancel an invocation that has already been copied for dispatch.
| callback_id | Id returned by add_log_callback. |
Implemented in logit::MdbxLogger, and logit::MemoryLogger.