LDMX Software
framework::logging::Filter Class Reference

Our filter implementation aligning with Boost.Log. More...

Public Member Functions

 Filter (level fallback, std::unordered_map< std::string, level > custom)
 
 Filter (level fallback)
 
bool operator() (log::attribute_value_set const &attrs)
 

Private Attributes

level fallback_level_
 
std::unordered_map< std::string, level > custom_levels_
 

Detailed Description

Our filter implementation aligning with Boost.Log.

We store a default "fallback" level that is applied to all channels that do not exist within the custom mapping. If a channel does exist within the custom mapping, that value is used instead of the default value.

Definition at line 56 of file Logger.cxx.

Constructor & Destructor Documentation

◆ Filter() [1/2]

framework::logging::Filter::Filter ( level fallback,
std::unordered_map< std::string, level > custom )
inline

Definition at line 61 of file Logger.cxx.

62 : fallback_level_{fallback}, custom_levels_{custom} {}

◆ Filter() [2/2]

framework::logging::Filter::Filter ( level fallback)
inline

Definition at line 63 of file Logger.cxx.

63: Filter(fallback, {}) {}

Member Function Documentation

◆ operator()()

bool framework::logging::Filter::operator() ( log::attribute_value_set const & attrs)
inline

Definition at line 64 of file Logger.cxx.

64 {
65 auto it = custom_levels_.find(safe_extract<std::string>(attrs["Channel"]));
66 if (it != custom_levels_.end()) {
67 return safe_extract<level>(attrs["Severity"]) >= it->second;
68 }
69 return safe_extract<level>(attrs["Severity"]) >= fallback_level_;
70 }

Member Data Documentation

◆ custom_levels_

std::unordered_map<std::string, level> framework::logging::Filter::custom_levels_
private

Definition at line 58 of file Logger.cxx.

◆ fallback_level_

level framework::logging::Filter::fallback_level_
private

Definition at line 57 of file Logger.cxx.


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