olp-cpp-sdk  1.22.0
Static Public Member Functions | List of all members
olp::logging::Log Class Reference

A primary interface for log messages. More...

#include <Log.h>

Static Public Member Functions

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...
 

Detailed Description

A primary interface for log messages.

Member Function Documentation

◆ 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
filtersThe 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
tagThe 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()

static Configuration olp::logging::Log::getConfiguration ( )
static

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
tagThe 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
levelThe log level.
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
tagThe tag for the log component.
levelThe 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
levelThe log level.
tagThe tag for the log component.
messageThe log message.
fileThe file that generated the message.
lineThe line in the file where the message was logged.
functionThe function that generated the message.
fullFunctionThe 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
levelThe log level.
tagThe 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
levelThe log level.

◆ 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
levelThe log level.
tagThe tag for the log component. If empty, it sets the default level.

The documentation for this class was generated from the following file: