Class SinkChannelFilterFn

Class Documentation

class SinkChannelFilterFn

A function that can be used to filter channels.

Accepts any callable with signature bool(const ChannelDescriptor&). Callables using the previous bool(ChannelDescriptor&&) signature are also accepted but deprecated.

Return:

false if the channel should not be logged to the given sink. By default, all channels are logged to a sink.

Public Functions

SinkChannelFilterFn() = default
template<typename F, typename = std::enable_if_t<std::is_invocable_r_v<bool, F, const ChannelDescriptor&> && !std::is_same_v<std::decay_t<F>, SinkChannelFilterFn>>>
inline SinkChannelFilterFn(F &&fn)

Construct from a callable that takes const ChannelDescriptor&.

template<typename F, typename = std::enable_if_t<std::is_invocable_r_v<bool, F, ChannelDescriptor&&> && !std::is_invocable_v<F, const ChannelDescriptor&> && !std::is_same_v<std::decay_t<F>, SinkChannelFilterFn>>, typename = void>
inline SinkChannelFilterFn(F &&fn)

Deprecated:

Use a filter function taking const ChannelDescriptor& instead of ChannelDescriptor&&.

inline explicit operator bool() const

Check if a filter function has been set.

inline bool operator()(const ChannelDescriptor &channel) const

Invoke the filter function.