24#include <unordered_map>
27#include <olp/core/CoreApi.h>
28#include <olp/core/logging/Level.h>
29#include <olp/core/porting/optional.h>
60 inline porting::optional<Level> getLevel()
const;
85 inline porting::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 porting::optional<Level> m_defaultLevel;
157 std::unordered_map<std::string, Level> m_tagLevels;
160inline FilterGroup::FilterGroup() : m_defaultLevel(porting::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 = porting::none;
187 const std::string& tag)
const {
188 auto foundIter = m_tagLevels.find(tag);
189 if (foundIter == m_tagLevels.end())
190 return porting::none;
191 return foundIter->second;
195 m_tagLevels[tag] = level;
200 m_tagLevels.erase(tag);
205 m_defaultLevel = porting::none;
Groups together log levels for different tags.
Definition FilterGroup.h:38
porting::optional< Level > getLevel() const
Gets the default log level.
Definition FilterGroup.h:172
FilterGroup & clearLevel()
Clears the default log level.
Definition FilterGroup.h:181
bool load(const std::string &fileName)
Loads the filter group from a file.
static porting::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 & operator=(const FilterGroup &)=default
The default copy assignment operator.
FilterGroup & clear()
Clears the filter group.
Definition FilterGroup.h:204
A primary interface for log messages.
Definition Log.h:431
Rules all the other namespaces.
Definition AppleSignInProperties.h:24