OpenAssetIO
An abstract API for generalising interactions between a host application and an asset management system
|
The SeverityFilter is a wrapper for a logger that drops messages below a requested severity. More...
#include <SeverityFilter.hpp>
Public Types | |
using | Ptr = SeverityFilterPtr |
using | ConstPtr = SeverityFilterConstPtr |
![]() | |
using | Ptr = LoggerInterfacePtr |
using | ConstPtr = LoggerInterfaceConstPtr |
enum | Severity { kDebugApi, kDebug, kInfo, kProgress, kWarning, kError, kCritical } |
Public Member Functions | |
LoggerInterfacePtr | upstreamLogger () const |
Returns the logger wrapped by the filter. More... | |
void | log (Severity severity, const Str &message) override |
Filter out messages based on severity before delegating to the upstreamLogger. More... | |
Filter Severity | |
Messages logged with a severity greater or equal to this will be displayed. | |
void | setSeverity (LoggerInterface::Severity severity) |
Sets the minimum severity of message that will be passed on to the upstreamLogger. More... | |
LoggerInterface::Severity | getSeverity () const |
Returns the minimum severity of message that will be passed on to the upstreamLogger. More... | |
bool | isSeverityLogged (Severity severity) const override |
Check if given severity will be logged. More... | |
![]() | |
virtual | ~LoggerInterface () |
Defaulted polymorphic destructor. More... | |
virtual void | log (Severity severity, const Str &message)=0 |
Logs a message to the user. More... | |
virtual bool | isSeverityLogged (Severity severity) const |
Check if a given severity level should/will be filtered out. More... | |
void | debugApi (const Str &message) |
void | debug (const Str &message) |
void | info (const Str &message) |
void | progress (const Str &message) |
void | warning (const Str &message) |
void | error (const Str &message) |
void | critical (const Str &message) |
Static Public Member Functions | |
static SeverityFilterPtr | make (LoggerInterfacePtr upstreamLogger) |
Creates a new instance of the SeverityFilter. More... | |
Additional Inherited Members | |
![]() | |
static constexpr std::array | kSeverityNames |
The SeverityFilter is a wrapper for a logger that drops messages below a requested severity.
More severe messages are relayed.
using ConstPtr = SeverityFilterConstPtr |
using Ptr = SeverityFilterPtr |
LoggerInterface::Severity getSeverity | ( | ) | const |
Returns the minimum severity of message that will be passed on to the upstreamLogger.
|
override |
Check if given severity will be logged.
Uses the value of getSeverity() as well as querying the upstreamLogger, and returns the most pessimistic answer.
This logic is used in log to determine which messages to filter out.
severity | Severity to check. |
Filter out messages based on severity before delegating to the upstreamLogger.
Whether a log is output or not obeys the result of isSeverityLogged
severity | Severity level. |
message | The message to be logged. |
|
static |
Creates a new instance of the SeverityFilter.
The filter defaults to the kWarning severity.
upstreamLogger | A logger that will receive messages of the requested severity or above. |
void setSeverity | ( | LoggerInterface::Severity | severity | ) |
Sets the minimum severity of message that will be passed on to the upstreamLogger.
severity | The minimum severity. |
LoggerInterfacePtr upstreamLogger | ( | ) | const |
Returns the logger wrapped by the filter.
Copyright 2013-2023 The Foundry Visionmongers Ltd. OpenAssetIO is released under the Apache 2.0 License