LogIt++
Header-only, macro-first C++ logging library
Loading...
Searching...
No Matches
ILogSubscriber.hpp
Go to the documentation of this file.
1#pragma once
2#ifndef LOGIT_CPP_HEADER_LOGIT_CPP_LOGIT_LOGGERS_ILOGSUBSCRIBER_HPP_INCLUDED
3#define LOGIT_CPP_HEADER_LOGIT_CPP_LOGIT_LOGGERS_ILOGSUBSCRIBER_HPP_INCLUDED
4
7
8#include "ILogReader.hpp"
9#include <cstdint>
10#include <functional>
11
12namespace logit {
13
22 public:
23 using Callback = std::function<void(const LogRecordSnapshot&)>;
24
25 virtual ~ILogSubscriber() = default;
26
30 virtual uint64_t add_log_callback(Callback callback) = 0;
31
38 virtual bool remove_log_callback(uint64_t callback_id) = 0;
39 };
40
41} // namespace logit
42
43#endif // LOGIT_CPP_HEADER_LOGIT_CPP_LOGIT_LOGGERS_ILOGSUBSCRIBER_HPP_INCLUDED
Optional read-only interface for log backends that support querying stored records.
Optional interface for backends that can notify callers when a record is successfully written.
std::function< void(const LogRecordSnapshot &)> Callback
virtual bool remove_log_callback(uint64_t callback_id)=0
Unregisters a previously added callback.
virtual ~ILogSubscriber()=default
virtual uint64_t add_log_callback(Callback callback)=0
Registers a callback to be invoked after each successfully written record.
The primary namespace for the LogIt++ library.
Common owning snapshot of a stored log record.