|
CIRCT 24.0.0git
|
A logger that writes to a C++ std::ostream. More...
#include <Logging.h>


Public Member Functions | |
| StreamLogger (Level minLevel, std::ostream &out, std::ostream &error) | |
| Create a stream logger that logs to the given output stream and error output stream. | |
| StreamLogger (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. | |
| Public Member Functions inherited from esi::TSLogger | |
| 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, bool traceEnabled) | |
| Public Member Functions inherited from esi::Logger | |
| Logger (bool debugEnabled, bool traceEnabled) | |
| virtual | ~Logger ()=default |
| bool | getDebugEnabled () |
| bool | getTraceEnabled () |
| 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. | |
| void | trace (const std::string &subsystem, const std::string &msg, const std::map< std::string, std::any > *details=nullptr) |
| Log a trace message. | |
| void | trace (std::function< void(std::string &subsystem, std::string &msg, std::unique_ptr< std::map< std::string, std::any > > &details)> traceFunc) |
| Log a trace message using a callback. | |
Private Attributes | |
| Level | minLevel |
| The minimum log level to emit. | |
| std::ostream & | outStream |
| Everything except errors goes here. | |
| std::ostream & | errorStream |
| Just for errors. | |
Additional Inherited Members | |
| Public Types inherited from esi::Logger | |
| enum class | Level { Trace , Debug , Info , Warning , Error } |
| Protected Member Functions inherited from esi::Logger | |
| 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. | |
| Protected Attributes inherited from esi::TSLogger | |
| std::mutex | mutex |
| Mutex to protect the stream from interleaved logging writes. | |
| Protected Attributes inherited from esi::Logger | |
| bool | debugEnabled = false |
| Enable or disable debug messages. | |
| bool | traceEnabled |
| Enable or disable trace messages. | |
|
inline |
Create a stream logger that logs to the given output stream and error output stream.
Definition at line 185 of file Logging.h.
References esi::Logger::error(), errorStream, minLevel, and outStream.
| StreamLogger::StreamLogger | ( | Level | minLevel | ) |
Create a stream logger that logs to stdout, stderr.
Definition at line 33 of file Logging.cpp.
References errorStream, minLevel, and outStream.
|
overridevirtual |
Subclasses must implement this method to log messages.
Implements esi::TSLogger.
Definition at line 37 of file Logging.cpp.
References esi::Logger::Debug, esi::Logger::Error, errorStream, esi::Logger::Info, minLevel, outStream, esi::toString(), esi::Logger::Trace, and esi::Logger::Warning.
|
private |
Just for errors.
Definition at line 201 of file Logging.h.
Referenced by logImpl(), StreamLogger(), and StreamLogger().
|
private |
The minimum log level to emit.
Definition at line 196 of file Logging.h.
Referenced by logImpl(), StreamLogger(), and StreamLogger().
|
private |
Everything except errors goes here.
Definition at line 199 of file Logging.h.
Referenced by logImpl(), StreamLogger(), and StreamLogger().