Simple-Log  alpha-v0.7
Flush-Policy

Classes

class  sl::log::FlushPolicy< TPredicate, TProjection, TInvocationRule >
 A customizable FlushPolicy class. More...
 
class  sl::log::FlushPolicyChain< TAlgorithm, TFlushPolicies >
 Chains multiple FlushPolicy objects together. More...
 
class  sl::log::FlushPolicyAllOf< TFlushPolicies >
 Convenience type for chaining multiple FlushPolicies with AND. More...
 
class  sl::log::FlushPolicyAnyOf< TFlushPolicies >
 Convenience type for chaining multiple FlushPolicies with OR. More...
 
class  sl::log::FlushPolicyNoneOf< TFlushPolicies >
 Convenience type for chaining multiple FlushPolicies with NOR. More...
 
class  sl::log::TimedFlushPolicy
 A Flush-Policy which acts on a durations. More...
 
class  sl::log::ByteCountFlushPolicy
 A Flush-Policy which acts on accumulated byte count. More...
 

Typedefs

using sl::log::AlwaysFlushPolicy = FlushPolicy< detail::ConstantInvokable< true > >
 A Flush-Policy which returns always true. More...
 

Functions

template<Record TRecord, std::predicate< const RecordMessage_t< TRecord > & > TUnaryPredicate>
constexpr auto sl::log::makeMessageFlushPolicyFor (TUnaryPredicate &&predicate)
 Factory function for creating Flush-Policies based on Record::message member. More...
 
template<Record TRecord, std::predicate< const RecordSeverity_t< TRecord > & > TUnaryPredicate>
constexpr auto sl::log::makeSeverityFlushPolicyFor (TUnaryPredicate &&predicate)
 Factory function for creating Flush-Policies based on Record::severity member. More...
 
template<Record TRecord, std::predicate< const RecordChannel_t< TRecord > & > TUnaryPredicate>
constexpr auto sl::log::makeChannelFlushPolicyFor (TUnaryPredicate &&predicate)
 Factory function for creating Flush-Policies based on Record::channel member. More...
 
template<Record TRecord, std::predicate< const RecordTimePoint_t< TRecord > & > TUnaryPredicate>
constexpr auto sl::log::makeTimePointFlushPolicyFor (TUnaryPredicate &&predicate)
 Factory function for creating Flush-Policies based on Record::timePoint member. More...
 

Detailed Description

Flush-Policies determine if the Sink, they are attached to, shall flush its stream. They will be invoked after each handled Record and shall return true if a flush should happen. After flushing the Sink will call the flushed() function, which Flush-Policies can then use to reset their internal state if necessary.

Users can use the provided Flush-Policy classes or create their own. Custom policies do not have to inherit from any base-class but must follow the interface defined by the FlushPolicyFor concept.

Typedef Documentation

◆ AlwaysFlushPolicy

using sl::log::AlwaysFlushPolicy = typedef FlushPolicy<detail::ConstantInvokable<true> >

A Flush-Policy which returns always true.

Function Documentation

◆ makeChannelFlushPolicyFor()

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

Factory function for creating Flush-Policies based on 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
Flush-Policy object

This is the preferable way creating a Flush-Policies based on 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 such Flush-Policies objects manually will potentially result in harder to read error messages.

◆ makeMessageFlushPolicyFor()

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

Factory function for creating Flush-Policies based on 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
Flush-Policy object

This is the preferable way creating a Flush-Policies based on 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 such Flush-Policies objects manually will potentially result in harder to read error messages.

◆ makeSeverityFlushPolicyFor()

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

Factory function for creating Flush-Policies based on 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
Flush-Policy object

This is the preferable way creating a Flush-Policies based on 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 such Flush-Policies objects manually will potentially result in harder to read error messages.

◆ makeTimePointFlushPolicyFor()

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

Factory function for creating Flush-Policies based on 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
Flush-Policy object

This is the preferable way creating a Flush-Policies based on 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 such Flush-Policies objects manually will potentially result in harder to read error messages.