Loading...
Searching...
No Matches
by::filters Class Reference

Collection of filterable objects for logging control. More...

#include <filters.hpp>

Inheritance diagram for by::filters:
by::filterable

Public Member Functions

template<typename... Es>
 filters (const Es *... elems)
 Constructs a filters object with multiple filterable elements.
 
ncnt len () const
 
void rel ()
 Clears all contained filterable objects without deleting them.
 
void add (const filterable &new1)
 Adds a filterable object to the collection.
 
void add (const filterable *new1)
 Adds a filterable object to the collection.
 
void del ()
 Deletes all owned filterable objects and clears the collection.
 
nbool filt (errLv::level lv, const std::string &tag) const
 Applies all contained filters to the log entry.
 

Detailed Description

Collection of filterable objects for logging control.

Manages multiple filterable objects registered in the logger class. Provides the same API as filterable, and calling an API on filters will invoke that API on all owned filterable objects.

Acts as a composite filter, allowing multiple filtering criteria to be applied to log messages simultaneously.

Constructor & Destructor Documentation

◆ filters()

template<typename... Es>
by::filters::filters ( const Es *... elems)
inlineexplicit

Constructs a filters object with multiple filterable elements.

This variadic template constructor allows convenient initialization of the filters object by adding multiple filterable instances.

Template Parameters
EsType of the filterable elements (must be convertible to filterable*).
Parameters
elemsPointers to the filterable objects to add.

Member Function Documentation

◆ add() [1/2]

void by::filters::add ( const filterable & new1)

Adds a filterable object to the collection.

Parameters
new1The filterable object to add. The filters object does not take ownership.

◆ add() [2/2]

void by::filters::add ( const filterable * new1)

Adds a filterable object to the collection.

Parameters
new1Pointer to the filterable object to add. The filters object does not take ownership.

◆ del()

void by::filters::del ( )

Deletes all owned filterable objects and clears the collection.

Note
This method assumes ownership of the added filterable pointers and deletes them.

◆ filt()

nbool by::filters::filt ( errLv::level lv,
const std::string & tag ) const
virtual

Applies all contained filters to the log entry.

This method returns true if any of the contained filterable objects return true for the given log entry, indicating it should be filtered out.

Parameters
lvThe error level of the log entry.
tagThe tag associated with the log entry.
Returns
true if the log entry should be filtered out (blocked), false otherwise.

Implements by::filterable.


The documentation for this class was generated from the following file: