carl  24.04
Computer ARithmetic Library
carl::logging::Filter Class Reference

This class checks if some log message shall be forwarded to some sink. More...

#include <Filter.h>

Collaboration diagram for carl::logging::Filter:

Public Member Functions

const auto & data () const
 Returns the internal filter data. More...
 
Filteroperator() (const std::string &channel, LogLevel level)
 Set the minimum log level for some channel. More...
 
bool check (const std::string &channel, LogLevel level) const noexcept
 Checks if the given log level is sufficient for the log message to be forwarded. More...
 

Private Attributes

std::map< std::string, LogLevelmData
 Mapping from channels to (minimal) log levels. More...
 

Friends

std::ostream & operator<< (std::ostream &os, const Filter &f)
 Streaming operator for a Filter. More...
 

Detailed Description

This class checks if some log message shall be forwarded to some sink.

Definition at line 15 of file Filter.h.

Member Function Documentation

◆ check()

bool carl::logging::Filter::check ( const std::string &  channel,
LogLevel  level 
) const
inlinenoexcept

Checks if the given log level is sufficient for the log message to be forwarded.

Parameters
channelChannel name.
levelLogLevel.
Returns
If the message shall be forwarded.

Definition at line 44 of file Filter.h.

◆ data()

const auto& carl::logging::Filter::data ( ) const
inline

Returns the internal filter data.

Definition at line 24 of file Filter.h.

◆ operator()()

Filter& carl::logging::Filter::operator() ( const std::string &  channel,
LogLevel  level 
)
inline

Set the minimum log level for some channel.

Returns *this, hence calls to this method can be chained arbitrarily.

Parameters
channelChannel name.
levelLogLevel.
Returns
This object.

Definition at line 34 of file Filter.h.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const Filter f 
)
friend

Streaming operator for a Filter.

All the rules stored in the filter are printed in a human-readable fashion.

Parameters
osOutput stream.
fFilter.
Returns
os.

Definition at line 66 of file Filter.h.

Field Documentation

◆ mData

std::map<std::string, LogLevel> carl::logging::Filter::mData
private
Initial value:
= {
std::make_pair(std::string(""), LogLevel::LVL_DEFAULT)
}
@ LVL_DEFAULT
Default log level.

Mapping from channels to (minimal) log levels.

Definition at line 17 of file Filter.h.


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