![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Core/Log/ConsoleSink.h>
Default implementation for a Logger that prints to the attached console/terminal. More...
Default implementation for a Logger that prints to the attached console/terminal.
Color output supports both Windows and POSIX terminals.
Public Types | |
enum | Options { None = 0 , UseColor = 1 << 0 , Utf8ConsoleCodepage = 1 << 1 , PrintSourceInfo = 1 << 2 , PrintDateTime = 1 << 3 } |
Configuration options. More... | |
Public Member Functions | |
ConsoleSink (Flags< Options > options=Options::None) | |
Instantiates a new ConsoleLogger with the given options. | |
![]() | |
void | log (const LogCapture &capture) |
Logs the given message. | |
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. | |
Protected Member Functions | |
void | logImpl (const LogCapture &capture) override |
Performs the actual logging of the given message. | |
void | flush () override |
Ensure that all log captures are fully committed/written. | |
Protected Attributes | |
bool | m_useColor = false |
bool | m_printSourceInfo = false |
bool | m_printDateTime = false |
enum Options |
Configuration options.
Enumerator | |
---|---|
None | Default. |
UseColor | Use colored console output. |
Utf8ConsoleCodepage | Set console code page to UTF-8 (Windows only, ignored on Linux) https://docs.microsoft.com/en-us/windows/console/setconsoleoutputcp. |
PrintSourceInfo | Print information on origin of log event (source file + line) |
PrintDateTime | Print date-time of logging event in current time zone. |
|
overrideprotectedvirtual |
|
overrideprotectedvirtual |
Ensure that all log captures are fully committed/written.
Implements Sink.