Groups together log levels for different tags.
More...
#include <FilterGroup.h>
|
|
| 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.
|
| |
| porting::optional< Level > | getLevel () const |
| | Gets the default log level.
|
| |
| FilterGroup & | setLevel (Level level) |
| | Sets the default log level.
|
| |
| FilterGroup & | clearLevel () |
| | Clears the default log level.
|
| |
| porting::optional< Level > | getLevel (const std::string &tag) const |
| | Gets the log level for a tag.
|
| |
| FilterGroup & | setLevel (Level level, const std::string &tag) |
| | Sets the log level for a tag.
|
| |
| FilterGroup & | clearLevel (const std::string &tag) |
| | Clears the log level for a tag.
|
| |
|
FilterGroup & | clear () |
| | Clears the filter group.
|
| |
| bool | load (const std::string &fileName) |
| | Loads the filter group from a file.
|
| |
| bool | load (std::istream &stream) |
| | Loads the filter group from a stream.
|
| |
|
| static porting::optional< Level > | stringToLevel (const std::string &levelStr) |
| | Converts the string log level to the enum level format.
|
| |
Groups together log levels for different tags.
It helps to apply groups of level filters together.
◆ clearLevel() [1/2]
| FilterGroup & olp::logging::FilterGroup::clearLevel |
( |
| ) |
|
|
inline |
Clears the default log level.
If the default log level is unset, it does not change when the filter group is applied.
◆ clearLevel() [2/2]
| FilterGroup & olp::logging::FilterGroup::clearLevel |
( |
const std::string & |
tag | ) |
|
|
inline |
Clears the log level for a tag.
If the log level for a tag is unset, the default log level is used instead.
◆ getLevel() [1/2]
| porting::optional< Level > olp::logging::FilterGroup::getLevel |
( |
| ) |
const |
|
inline |
Gets the default log level.
- Returns
- The default log level or
olp::porting::none if the level is not set.
◆ getLevel() [2/2]
| porting::optional< Level > olp::logging::FilterGroup::getLevel |
( |
const std::string & |
tag | ) |
const |
|
inline |
Gets the log level for a tag.
- Parameters
-
| tag | The tag for which to get the log level. |
- Returns
- The log level for the tag, or
olp::porting::none if the level is not set.
◆ load() [1/2]
| bool olp::logging::FilterGroup::load |
( |
const std::string & |
fileName | ) |
|
Loads the filter group from a file.
- Parameters
-
| fileName | The file from which to load the configuration. |
- Returns
- True if the load was successful; false otherwise. If unsuccessful, this is cleared.
◆ load() [2/2]
| 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:
- Blank lines or lines that start with "#" are ignored.
- Use the following format for tag log levels:
tag: level. For example:
mylib: warning
theirlib: info
otherlib: off
- Use the following format for the default log level:
: level. For example: : error
- Whitespaces are trimmed.
- The case is ignored for levels.
The filter groups are cleared before the content of the stream is applied.
- Parameters
-
| stream | The stream from which to load the configuration. |
- Returns
- True if the load was successful; false otherwise. If unsuccessful, this is cleared.
◆ setLevel() [1/2]
| FilterGroup & olp::logging::FilterGroup::setLevel |
( |
Level |
level | ) |
|
|
inline |
Sets the default log level.
- Parameters
-
| level | The default log level. |
◆ setLevel() [2/2]
| FilterGroup & olp::logging::FilterGroup::setLevel |
( |
Level |
level, |
|
|
const std::string & |
tag |
|
) |
| |
|
inline |
Sets the log level for a tag.
- Parameters
-
| level | The log level for a tag. |
| tag | The tag for which to set the level. |
◆ stringToLevel()
| static porting::optional< Level > olp::logging::FilterGroup::stringToLevel |
( |
const std::string & |
levelStr | ) |
|
|
static |
Converts the string log level to the enum level format.
- Parameters
-
| levelStr | The string level to convert. |
- Returns
- The converted level.
The documentation for this class was generated from the following file: