Simple-Log  alpha-v0.7
Filter

Classes

class  sl::log::ProjectionFilter< TProjection, TUnaryPredicate >
 Combines a projection on Record type with a predicate into an invokable object. More...
 
class  sl::log::FilterChain< TAlgorithm, TFilter >
 Chains multiple filter together. More...
 
class  sl::log::FilterAllOf< TFilter >
 Convenience type for chaining multiple filter with AND. More...
 
class  sl::log::FilterAnyOf< TFilter >
 Convenience type for chaining multiple filter with OR. More...
 
class  sl::log::FilterNoneOf< TFilter >
 Convenience type for chaining multiple filter with NOR. More...
 

Functions

template<Record TRecord, std::predicate< const RecordMessage_t< TRecord > & > TUnaryPredicate>
constexpr auto sl::log::makeMessageFilterFor (TUnaryPredicate &&predicate)
 Factory function for creating ProjectionFilter of Record::message member. More...
 
template<Record TRecord, std::predicate< const RecordSeverity_t< TRecord > & > TUnaryPredicate>
constexpr auto sl::log::makeSeverityFilterFor (TUnaryPredicate &&predicate)
 Factory function for creating ProjectionFilter of Record::severity member. More...
 
template<Record TRecord, std::predicate< const RecordChannel_t< TRecord > & > TUnaryPredicate>
constexpr auto sl::log::makeChannelFilterFor (TUnaryPredicate &&predicate)
 Factory function for creating ProjectionFilter of Record::channel member. More...
 
template<Record TRecord, std::predicate< const RecordTimePoint_t< TRecord > & > TUnaryPredicate>
constexpr auto sl::log::makeTimePointFilterFor (TUnaryPredicate &&predicate)
 Factory function for creating ProjectionFilter of Record::timePoint member. More...
 

Detailed Description

Filters operate on Sink level and determine if a Record will be handled by that Sink object or skipped. Users are able apply provided filter like the ProjectionFilter types or use custom types. Those custom types can be from any type which is invokable by the used Record type and returning a bool (or at least a bool-comparable-type) as result.

There are already some convenience factory function present (e.g. makeMessageProjectionFor), which may help setting up filters quickly.

Function Documentation

◆ makeChannelFilterFor()

template<Record TRecord, std::predicate< const RecordChannel_t< TRecord > & > TUnaryPredicate>
constexpr auto sl::log::makeChannelFilterFor ( TUnaryPredicate &&  predicate)
constexpr

Factory function for creating ProjectionFilter of Record::channel member.

Template Parameters
TRecordConcrete Record type on which to apply the projection
TUnaryPredicateInvokable type, which has to accept objects the actual Record::Channel_t type
Parameters
predicatePredicate object
Returns
ProjectionFilter object

This is the preferable way creating a filter for the Record::channel member, because the predicate becomes strong checked via concept and therefore will provide much clearer feedback in cases of error, while creating ProjectionFilter objects manually will potentially result in harder to read error message.

◆ makeMessageFilterFor()

template<Record TRecord, std::predicate< const RecordMessage_t< TRecord > & > TUnaryPredicate>
constexpr auto sl::log::makeMessageFilterFor ( TUnaryPredicate &&  predicate)
constexpr

Factory function for creating ProjectionFilter of Record::message member.

Template Parameters
TRecordConcrete Record type on which to apply the projection
TUnaryPredicateInvokable type, which has to accept objects the actual Record::Message_t type
Parameters
predicatePredicate object
Returns
ProjectionFilter object

This is the preferable way creating a filter for the Record::message member, because the predicate becomes strong checked via concept and therefore will provide much clearer feedback in cases of error, while creating ProjectionFilter objects manually will potentially result in harder to read error message.

◆ makeSeverityFilterFor()

template<Record TRecord, std::predicate< const RecordSeverity_t< TRecord > & > TUnaryPredicate>
constexpr auto sl::log::makeSeverityFilterFor ( TUnaryPredicate &&  predicate)
constexpr

Factory function for creating ProjectionFilter of Record::severity member.

Template Parameters
TRecordConcrete Record type on which to apply the projection
TUnaryPredicateInvokable type, which has to accept objects the actual Record::SeverityLevel_t type
Parameters
predicatePredicate object
Returns
ProjectionFilter object

This is the preferable way creating a filter for the Record::severity member, because the predicate becomes strong checked via concept and therefore will provide much clearer feedback in cases of error, while creating ProjectionFilter objects manually will potentially result in harder to read error message.

◆ makeTimePointFilterFor()

template<Record TRecord, std::predicate< const RecordTimePoint_t< TRecord > & > TUnaryPredicate>
constexpr auto sl::log::makeTimePointFilterFor ( TUnaryPredicate &&  predicate)
constexpr

Factory function for creating ProjectionFilter of Record::timePoint member.

Template Parameters
TRecordConcrete Record type on which to apply the projection
TUnaryPredicateInvokable type, which has to accept objects the actual Record::TimePoint_t type
Parameters
predicatePredicate object
Returns
ProjectionFilter object

This is the preferable way creating a filter for the Record::timePoint member, because the predicate becomes strong checked via concept and therefore will provide much clearer feedback in cases of error, while creating ProjectionFilter objects manually will potentially result in harder to read error message.