Abstract logger; downstream supplies an implementation. More...
#include <logger.hpp>
Public Member Functions | |
| Logger ()=default | |
| virtual | ~Logger ()=default |
| Logger (const Logger &)=delete | |
| Logger & | operator= (const Logger &)=delete |
| Logger (Logger &&)=delete | |
| Logger & | operator= (Logger &&)=delete |
| virtual void | Emit (LogLevel level, const std::string &message)=0 |
| Deliver one already-formatted log line. | |
| virtual void | Throw (const std::string &message) |
| Log at error level and then throw. | |
| void | SetLogLevel (LogLevel level) noexcept |
| LogLevel | GetLogLevel () const noexcept |
Convenience wrappers | |
These funnel through | |
| void | Trace (const std::string &m) |
| void | Debug (const std::string &m) |
| void | Info (const std::string &m) |
| void | Warning (const std::string &m) |
| void | Error (const std::string &m) |
Protected Attributes | |
| LogLevel | m_level {LogLevel::INFO} |
Abstract logger; downstream supplies an implementation.
Subclasses must override Emit() (and may override Throw() to customise the exception type or to perform side-effects such as errAdd before throwing). All other methods are convenience wrappers that funnel through Emit().
Implementations are free to add their own filtering on top of the threshold maintained here (e.g. CII's per-logger config). The threshold on this base class governs the early-out in the UAT* macros — its purpose is to keep disabled-level log calls cheap, not to be the single source of truth for routing decisions in the underlying backend.
|
default |
|
virtualdefault |
|
delete |
|
delete |
|
inline |
|
pure virtual |
Deliver one already-formatted log line.
Subclasses route this to their backend (log4cplus, CII, VLT cutePRINT, stdout, …). message has no trailing newline; backends add one if their format requires it.
|
inline |
|
inlinenoexcept |
|
inline |
|
inlinenoexcept |
|
virtual |
Log at error level and then throw.
Default implementation emits at ERROR and throws std::runtime_error. Subclasses may override to throw a different exception type or to record the error in a platform-specific error stack (e.g. VLT errAdd) before throwing.
|
inline |
|
inline |
|
protected |