#include <ImFusion/Core/Log/Sink.h>
Interface for a logger sink that can receive individual log events.
More...
Interface for a logger sink that can receive individual log events.
|
void | log (const LogCapture &capture) |
| Logs the given message.
|
|
virtual void | flush ()=0 |
| Ensure that all log captures are fully committed/written.
|
|
bool | isAccepted (Level level, const char *category) noexcept |
| Checks whether a log message of given level and category is accepted (i.e.
|
|
void | addWhitelistFilter (Log::Level minLevel, const std::string &category) |
| Adds a whitelist filter for this logger: both conditions of the filter must be met to accept a message.
|
|
void | addBlacklistFilter (Log::Level maxLevel, const std::string &category) |
| Adds a blacklist filter for this logger: both conditions of the filter must be met to reject a message.
|
|
const std::vector< Filter > & | whitelistFilters () const |
| Return the set of whitelist filters.
|
|
const std::vector< Filter > & | blacklistFilters () const |
| Return the set of blacklist filters.
|
|
void | removeFilters (const std::string &category) |
| Removes all filters matching category .
|
|
void | clearFilters () |
| Clear all filters.
|
|
bool | isEnabled () const |
| Returns the flag whether this logger is enabled.
|
|
void | setEnabled (bool value) |
| Sets the flag whether this logger is enabled.
|
|
|
virtual void | logImpl (const LogCapture &capture)=0 |
| Performs the actual logging of the given message.
|
|
◆ log()
Logs the given message.
Calls logImpl() if the message passes all registered filters.
- Parameters
-
◆ flush()
◆ isAccepted()
bool isAccepted |
( |
Level | level, |
|
|
const char * | category ) |
|
noexcept |
Checks whether a log message of given level and category is accepted (i.e.
consumed) by this Sink. A message is accepted in case it does not match any blacklist filter or if it matches at least one whitelist filter. If there are no filters defined all messages are accepted.
◆ addWhitelistFilter()
Adds a whitelist filter for this logger: both conditions of the filter must be met to accept a message.
In case of multiple whitelist filters, messages matching at least one filter will be logged, even if they also match a blacklist filter. If there are no filters defined, all messages are accepted.
- Parameters
-
minLevel | Minimum log level, messages of this level or higher will be logged. |
category | Category filter, messages where the category contains category will be logged. Leave empty to accept all categories. |
◆ addBlacklistFilter()
Adds a blacklist filter for this logger: both conditions of the filter must be met to reject a message.
Only messages matching a whitelist filter or not matching any blacklist filter will be logged (i.e. whitelist filters take precedence over blacklist filters). If there are no filters defined all messages are accepted.
- Parameters
-
maxLevel | Maximum log level, messages of this level or lower will not be logged. |
category | Category filter, messages where the category contains category will not be logged. Leave empty to reject all categories. |
◆ logImpl()
virtual void logImpl |
( |
const LogCapture & | capture | ) |
|
|
protectedpure virtual |
The documentation for this class was generated from the following file: