CIRCT 21.0.0git
|
A logger that writes to the console. Includes color support. More...
#include <Logging.h>
Public Member Functions | |
ConsoleLogger (Level minLevel) | |
Create a stream logger that logs to stdout, stderr. | |
void | logImpl (Level level, const std::string &subsystem, const std::string &msg, const std::map< std::string, std::any > *details) override |
Subclasses must implement this method to log messages. | |
![]() | |
void | log (Level level, const std::string &subsystem, const std::string &msg, const std::map< std::string, std::any > *details) override final |
Grabs the lock and calls logImpl. | |
Logger (bool debugEnabled) | |
![]() | |
Logger (bool debugEnabled) | |
virtual | ~Logger ()=default |
bool | getDebugEnabled () |
virtual void | error (const std::string &subsystem, const std::string &msg, const std::map< std::string, std::any > *details=nullptr) |
Report an error. | |
virtual void | warning (const std::string &subsystem, const std::string &msg, const std::map< std::string, std::any > *details=nullptr) |
Report a warning. | |
virtual void | info (const std::string &subsystem, const std::string &msg, const std::map< std::string, std::any > *details=nullptr) |
Report an informational message. | |
void | debug (const std::string &subsystem, const std::string &msg, const std::map< std::string, std::any > *details=nullptr) |
Report a debug message. | |
void | debug (std::function< void(std::string &subsystem, std::string &msg, std::unique_ptr< std::map< std::string, std::any > > &details)> debugFunc) |
Call the debug function callback only if debug is enabled then log a debug message. | |
Private Attributes | |
Level | minLevel |
The minimum log level to emit. | |
Additional Inherited Members | |
![]() | |
enum class | Level { Debug , Info , Warning , Error } |
![]() | |
virtual void | debugImpl (const std::string &subsystem, const std::string &msg, const std::map< std::string, std::any > *details) |
Overrideable version of debug. Only gets called if debug is enabled. | |
virtual void | debugImpl (std::function< void(std::string &subsystem, std::string &msg, std::unique_ptr< std::map< std::string, std::any > > &details)> debugFunc) |
Overrideable version of debug. Only gets called if debug is enabled. | |
![]() | |
std::mutex | mutex |
Mutex to protect the stream from interleaved logging writes. | |
![]() | |
bool | debugEnabled = false |
Enable or disable debug messages. | |
A logger that writes to the console. Includes color support.
ConsoleLogger::ConsoleLogger | ( | Level | minLevel | ) |
Create a stream logger that logs to stdout, stderr.
Definition at line 78 of file Logging.cpp.
|
overridevirtual |
Subclasses must implement this method to log messages.
Implements esi::TSLogger.
Definition at line 81 of file Logging.cpp.
References esi::Logger::Debug, esi::Logger::Error, esi::Logger::Info, minLevel, esi::toString(), and esi::Logger::Warning.
|
private |