olp-cpp-sdk
1.22.0
|
Groups together log levels for different tags. More...
#include <FilterGroup.h>
Public Member Functions | |
FilterGroup (const FilterGroup &)=default | |
The default copy constructor. | |
FilterGroup & | operator= (const FilterGroup &)=default |
The default copy assignment operator. | |
FilterGroup (FilterGroup &&other) noexcept | |
The default move constructor. | |
FilterGroup & | operator= (FilterGroup &&other) noexcept |
The default move assignment operator. | |
boost::optional< Level > | getLevel () const |
Gets the default log level. More... | |
FilterGroup & | setLevel (Level level) |
Sets the default log level. More... | |
FilterGroup & | clearLevel () |
Clears the default log level. More... | |
boost::optional< Level > | getLevel (const std::string &tag) const |
Gets the log level for a tag. More... | |
FilterGroup & | setLevel (Level level, const std::string &tag) |
Sets the log level for a tag. More... | |
FilterGroup & | clearLevel (const std::string &tag) |
Clears the log level for a tag. More... | |
FilterGroup & | clear () |
Clears the filter group. | |
bool | load (const std::string &fileName) |
Loads the filter group from a file. More... | |
bool | load (std::istream &stream) |
Loads the filter group from a stream. More... | |
Static Public Member Functions | |
static boost::optional< Level > | stringToLevel (const std::string &levelStr) |
Converts the string log level to the enum level format. More... | |
Friends | |
class | Log |
Groups together log levels for different tags.
It helps to apply groups of level filters together.
|
inline |
Clears the default log level.
If the default log level is unset, it does not change when the filter group is applied.
|
inline |
Clears the log level for a tag.
If the log level for a tag is unset, the default log level is used instead.
|
inline |
Gets the default log level.
boost::none
if the level is not set.
|
inline |
Gets the log level for a tag.
tag | The tag for which to get the log level. |
boost::none
if the level is not set. bool olp::logging::FilterGroup::load | ( | const std::string & | fileName | ) |
Loads the filter group from a file.
fileName | The file from which to load the configuration. |
bool olp::logging::FilterGroup::load | ( | std::istream & | stream | ) |
Loads the filter group from a stream.
The stream should contain text data. The format of the stream:
tag: level
. For example:mylib: warning
theirlib: info
otherlib: off
: level
. For example: : error
The filter groups are cleared before the content of the stream is applied.
stream | The stream from which to load the configuration. |
|
inline |
Sets the default log level.
level | The default log level. |
|
inline |
Sets the log level for a tag.
level | The log level for a tag. |
tag | The tag for which to set the level. |
|
static |
Converts the string log level to the enum level format.
levelStr | The string level to convert. |