An abstract base class that defines the receiving interface for log messages generated a manager or the API middleware.
More...
#include <LoggerInterface.hpp>
An abstract base class that defines the receiving interface for log messages generated a manager or the API middleware.
- Note
- OpenAssetIO makes use of shared pointers to facilitate object lifetime management across multiple languages. Instances passed into API methods via shared pointer may have their lifetimes extended beyond that of your code.
Enumerator |
---|
kDebugApi |
|
kDebug |
|
kInfo |
|
kProgress |
|
kWarning |
|
kError |
|
kCritical |
|
Defaulted polymorphic destructor.
void critical |
( |
const Str & |
message | ) |
|
void debug |
( |
const Str & |
message | ) |
|
void debugApi |
( |
const Str & |
message | ) |
|
void error |
( |
const Str & |
message | ) |
|
void info |
( |
const Str & |
message | ) |
|
virtual bool isSeverityLogged |
( |
Severity |
severity | ) |
const |
|
virtual |
Check if a given severity level should/will be filtered out.
The implementation of the logger may have a mechanism by which certain severity levels are not output. If a severity level is not output, then constructing a string to pass to the logger is wasted effort. This method can be queried before constructing a complex string, in order to avoid that wasted effort.
Implementors of LoggerInterface subclasses should override this method if they wish to conditionally skip logging at particular severity levels.
If log is called regardless, with a severity that elicits a false
response from this method, then the logger may still output the message, but it is not guaranteed (and is discouraged).
The default implementation returns true
for all severities.
- Parameters
-
severity | Severity level to check. |
- Returns
- Whether a message will be output if
log
is called with the given severity.
virtual void log |
( |
Severity |
severity, |
|
|
const Str & |
message |
|
) |
| |
|
pure virtual |
Logs a message to the user.
This method must be implemented to present the supplied message to the user in an appropriate fashion.
- Parameters
-
severity | One of the severity constants defined in Severity. |
message | The message string to be logged. |
Implemented in ConsoleLogger.
void progress |
( |
const Str & |
message | ) |
|
void warning |
( |
const Str & |
message | ) |
|
constexpr std::array kSeverityNames |
|
static |
Initial value:{"debugApi", "debug", "info", "progress",
"warning", "error", "critical"}
The documentation for this class was generated from the following file:
- /src/src/openassetio-core/include/openassetio/log/LoggerInterface.hpp