A primary interface for log messages.
More...
#include <Log.h>
|
static bool | configure (Configuration configuration) |
| Configures the log system. More...
|
|
static Configuration | getConfiguration () |
| Gets a copy of the current configuration. More...
|
|
static void | setLevel (Level level) |
| Sets the default log level. More...
|
|
static Level | getLevel () |
| Gets the default log level. More...
|
|
static void | setLevel (Level level, const std::string &tag) |
| Sets the log level for a tag. More...
|
|
static void | setLevel (const std::string &level, const std::string &tag) |
| Sets the log level for a tag. More...
|
|
static boost::optional< Level > | getLevel (const std::string &tag) |
| Gets the log level for a tag. More...
|
|
static void | clearLevel (const std::string &tag) |
| Clears the log level for a tag and sets it to the default value. More...
|
|
static void | clearLevels () |
| Clears the log levels for all tags and sets them to the default value.
|
|
static void | applyFilterGroup (const FilterGroup &filters) |
| Applies a filter group. More...
|
|
static bool | isEnabled (Level level) |
| Checks whether a level is enabled by default. More...
|
|
static bool | isEnabled (Level level, const std::string &tag) |
| Checks whether a log tag is enabled for a level. More...
|
|
static void | logMessage (Level level, const std::string &tag, const std::string &message, const char *file, unsigned int line, const char *function, const char *fullFunction) |
| Logs a message to the registered appenders. More...
|
|
A primary interface for log messages.
◆ applyFilterGroup()
static void olp::logging::Log::applyFilterGroup |
( |
const FilterGroup & |
filters | ) |
|
|
static |
Applies a filter group.
It clears all the log levels for tags and replaces them with the levels set in the filter group. If the default log level is set in the filter group, it is also applied.
- Parameters
-
filters | The filter group to apply. |
◆ clearLevel()
static void olp::logging::Log::clearLevel |
( |
const std::string & |
tag | ) |
|
|
static |
Clears the log level for a tag and sets it to the default value.
- Parameters
-
tag | The tag for the log component. |
◆ configure()
static bool olp::logging::Log::configure |
( |
Configuration |
configuration | ) |
|
|
static |
Configures the log system.
It overrides the previous configuration.
- Returns
- False if the configuration is invalid. The configuration does not change in this case.
◆ getConfiguration()
Gets a copy of the current configuration.
Use it to add an appender and reconfigure the system.
- Returns
- A copy of the current configuration.
◆ getLevel() [1/2]
static Level olp::logging::Log::getLevel |
( |
| ) |
|
|
static |
Gets the default log level.
- Returns
- The log level.
◆ getLevel() [2/2]
static boost::optional<Level> olp::logging::Log::getLevel |
( |
const std::string & |
tag | ) |
|
|
static |
Gets the log level for a tag.
- Parameters
-
tag | The tag for the log component. If empty, it sets the default level. |
- Returns
- The log level for the tag or
core::None
if the log level is unset.
◆ isEnabled() [1/2]
static bool olp::logging::Log::isEnabled |
( |
Level |
level | ) |
|
|
static |
Checks whether a level is enabled by default.
- Parameters
-
- Returns
- True if the log is enabled; false otherwise.
◆ isEnabled() [2/2]
static bool olp::logging::Log::isEnabled |
( |
Level |
level, |
|
|
const std::string & |
tag |
|
) |
| |
|
static |
Checks whether a log tag is enabled for a level.
- Parameters
-
tag | The tag for the log component. |
level | The log level. |
- Returns
- True if the log is enabled; false otherwise.
◆ logMessage()
static void olp::logging::Log::logMessage |
( |
Level |
level, |
|
|
const std::string & |
tag, |
|
|
const std::string & |
message, |
|
|
const char * |
file, |
|
|
unsigned int |
line, |
|
|
const char * |
function, |
|
|
const char * |
fullFunction |
|
) |
| |
|
static |
Logs a message to the registered appenders.
Outputting to the appender depends on whether the appender is enabled for this level.
- Parameters
-
level | The log level. |
tag | The tag for the log component. |
message | The log message. |
file | The file that generated the message. |
line | The line in the file where the message was logged. |
function | The function that generated the message. |
fullFunction | The fully qualified function that generated the message. |
◆ setLevel() [1/3]
static void olp::logging::Log::setLevel |
( |
const std::string & |
level, |
|
|
const std::string & |
tag |
|
) |
| |
|
static |
Sets the log level for a tag.
It overrides the default configurations.
- Parameters
-
level | The log level. |
tag | The tag for the log component. If empty, it sets the default level. |
◆ setLevel() [2/3]
static void olp::logging::Log::setLevel |
( |
Level |
level | ) |
|
|
static |
Sets the default log level.
No messages below this level are displayed unless overridden by specific log tags.
- Parameters
-
◆ setLevel() [3/3]
static void olp::logging::Log::setLevel |
( |
Level |
level, |
|
|
const std::string & |
tag |
|
) |
| |
|
static |
Sets the log level for a tag.
It overrides the default configurations.
- Parameters
-
level | The log level. |
tag | The tag for the log component. If empty, it sets the default level. |
The documentation for this class was generated from the following file:
- olp-cpp-sdk-core/include/olp/core/logging/Log.h