6 #ifndef SL_LOG_ISINK_HPP
7 #define SL_LOG_ISINK_HPP
14 #include <type_traits>
27 template <Record TRecord>
62 virtual
void setEnabled(
bool enable = true) noexcept = 0;
93 template <
Record TRecord, std::derived_from<
ISink<TRecord>> TSink>
104 m_Sink->setEnabled(
false);
114 m_Sink->setEnabled();
134 *
this = std::move(other);
143 swap(m_Sink, other.m_Sink);
152 TSink& operator *() const noexcept
162 TSink* operator ->() const noexcept
172 TSink*
get() const noexcept
178 TSink* m_Sink =
nullptr;
182 public std::runtime_error
186 runtime_error{ message }
191 runtime_error{ message }
Sink interface class.
Definition: ISink.hpp:29
virtual ~ISink() noexcept=default
virtual default destructor
virtual void log(const Record_t &record)=0
virtual log function
virtual bool isEnabled() const noexcept=0
Checks if the Sink object is enabled.
ISink & operator=(const ISink &)=delete
Deleted copy-assign operator.
std::remove_cvref_t< TRecord > Record_t
Used Record type.
Definition: ISink.hpp:34
virtual void setEnabled(bool enable=true) noexcept=0
Enables or disables the Sink object.
ISink(const ISink &)=delete
Deleted copy-constructor.
Wrapper class which disables Sinks on construction and enables them on destruction.
Definition: ISink.hpp:95
ScopedSinkDisabling(TSink &sink) noexcept
Constructor which disables passed sink.
Definition: ISink.hpp:101
~ScopedSinkDisabling() noexcept
Constructor which enables passed sink.
Definition: ISink.hpp:110
ScopedSinkDisabling(ScopedSinkDisabling &&other) noexcept
Move constructor.
Definition: ISink.hpp:132
ScopedSinkDisabling(const ScopedSinkDisabling &)=delete
Deleted copy constructor.
TSink * get() const noexcept
Returns a pointer to the Sink instance.
Definition: ISink.hpp:172
Definition: ISink.hpp:183
SinkException(const std::string &message)
Definition: ISink.hpp:185
SinkException(const char *message)
Definition: ISink.hpp:190
concept Record
Concept which all the necessary concepts for Record types.
Definition: Record.hpp:204
Definition: BasicSink.hpp:22