17 std::map<std::string, LogLevel>
mData = {
35 mData[channel] = level;
46 auto it =
mData.find(tmp);
47 while (!tmp.empty() && it ==
mData.end()) {
48 auto n = tmp.rfind(
'.');
49 tmp = (n == std::string::npos) ?
"" : tmp.substr(0, n);
52 if (it ==
mData.end()) {
53 std::cout <<
"Did not find something for \"" << channel <<
"\"" << std::endl;
56 assert(it !=
mData.end());
57 return level >= it->second;
67 os <<
"Filter:" << std::endl;
68 for (
const auto& it: f.
mData) {
69 os <<
"\t\"" << it.first <<
"\" -> " << it.second << std::endl;
Contains a custom logging facility.
LogLevel
Indicated which log messages should be forwarded to some sink.
@ LVL_DEFAULT
Default log level.
This class checks if some log message shall be forwarded to some sink.
Filter & operator()(const std::string &channel, LogLevel level)
Set the minimum log level for some channel.
friend std::ostream & operator<<(std::ostream &os, const Filter &f)
Streaming operator for a Filter.
std::map< std::string, LogLevel > mData
Mapping from channels to (minimal) log levels.
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.
const auto & data() const
Returns the internal filter data.