24 #include <unordered_map>
27 #include <boost/none.hpp>
28 #include <boost/optional.hpp>
30 #include <olp/core/CoreApi.h>
31 #include <olp/core/logging/Level.h>
61 inline boost::optional<Level> getLevel()
const;
85 inline boost::optional<Level> getLevel(
const std::string& tag)
const;
93 inline FilterGroup& setLevel(Level level,
const std::string& tag);
101 inline FilterGroup& clearLevel(
const std::string& tag);
116 bool load(
const std::string& fileName);
142 bool load(std::istream& stream);
156 boost::optional<Level> m_defaultLevel;
157 std::unordered_map<std::string, Level> m_tagLevels;
160 inline FilterGroup::FilterGroup() : m_defaultLevel(boost::none) {}
163 : m_defaultLevel(std::move(other.m_defaultLevel)),
164 m_tagLevels(std::move(other.m_tagLevels)) {}
167 m_defaultLevel = std::move(other.m_defaultLevel);
168 m_tagLevels = std::move(other.m_tagLevels);
173 return m_defaultLevel;
177 m_defaultLevel = level;
182 m_defaultLevel = boost::none;
187 const std::string& tag)
const {
188 auto foundIter = m_tagLevels.find(tag);
189 if (foundIter == m_tagLevels.end())
return boost::none;
190 return foundIter->second;
194 m_tagLevels[tag] = level;
199 m_tagLevels.erase(tag);
204 m_defaultLevel = boost::none;
Groups together log levels for different tags.
Definition: FilterGroup.h:40
FilterGroup & clearLevel()
Clears the default log level.
Definition: FilterGroup.h:181
FilterGroup & operator=(const FilterGroup &)=default
The default copy assignment operator.
bool load(const std::string &fileName)
Loads the filter group from a file.
static boost::optional< Level > stringToLevel(const std::string &levelStr)
Converts the string log level to the enum level format.
bool load(std::istream &stream)
Loads the filter group from a stream.
FilterGroup(const FilterGroup &)=default
The default copy constructor.
FilterGroup & setLevel(Level level)
Sets the default log level.
Definition: FilterGroup.h:176
FilterGroup & clear()
Clears the filter group.
Definition: FilterGroup.h:203
boost::optional< Level > getLevel() const
Gets the default log level.
Definition: FilterGroup.h:172
A primary interface for log messages.
Definition: Log.h:432
Rules all the other namespaces.
Definition: AppleSignInProperties.h:24