Main logger class.
More...
#include <Logger.h>
|
std::map< std::string, std::tuple< std::shared_ptr< Sink >, Filter, std::shared_ptr< Formatter > > > | mData |
| Mapping from channels to associated logging classes. More...
|
|
std::mutex | mMutex |
| Logging mutex to ensure thread-safe logging. More...
|
|
Main logger class.
Definition at line 74 of file Logger.h.
◆ configure() [1/3]
void carl::logging::Logger::configure |
( |
const std::string & |
id, |
|
|
const std::string & |
filename |
|
) |
| |
|
inline |
◆ configure() [2/3]
void carl::logging::Logger::configure |
( |
const std::string & |
id, |
|
|
std::ostream & |
os |
|
) |
| |
|
inline |
◆ configure() [3/3]
void carl::logging::Logger::configure |
( |
const std::string & |
id, |
|
|
std::shared_ptr< Sink > |
sink |
|
) |
| |
|
inline |
Installs the given sink.
If a Sink with this name is already present, it is overwritten.
- Parameters
-
Definition at line 96 of file Logger.h.
◆ filter()
Filter& carl::logging::Logger::filter |
( |
const std::string & |
id | ) |
|
|
inlinenoexcept |
◆ formatter() [1/2]
const std::shared_ptr<Formatter>& carl::logging::Logger::formatter |
( |
const std::string & |
id | ) |
|
|
inlinenoexcept |
◆ formatter() [2/2]
void carl::logging::Logger::formatter |
( |
const std::string & |
id, |
|
|
std::shared_ptr< Formatter > |
fmt |
|
) |
| |
|
inlinenoexcept |
◆ getInstance()
Returns the single instance of this class by reference.
If there is no instance yet, a new one is created.
Definition at line 45 of file Singleton.h.
◆ has()
bool carl::logging::Logger::has |
( |
const std::string & |
id | ) |
const |
|
inlinenoexcept |
Check if a Sink with the given id has been installed.
- Parameters
-
- Returns
- If a Sink with this id is present.
Definition at line 87 of file Logger.h.
◆ log()
void carl::logging::Logger::log |
( |
LogLevel |
level, |
|
|
const std::string & |
channel, |
|
|
const std::stringstream & |
ss, |
|
|
const RecordInfo & |
info |
|
) |
| |
|
inline |
Logs a message.
- Parameters
-
level | LogLevel. |
channel | Channel name. |
ss | Message to be logged. |
info | Auxiliary information. |
Definition at line 177 of file Logger.h.
◆ resetFormatter()
void carl::logging::Logger::resetFormatter |
( |
| ) |
|
|
inlinenoexcept |
Reconfigures all Formatter objects.
This should be done once after all configuration is finished.
Definition at line 151 of file Logger.h.
◆ visible()
bool carl::logging::Logger::visible |
( |
LogLevel |
level, |
|
|
const std::string & |
channel |
|
) |
| const |
|
inlinenoexcept |
Checks whether a log message would be visible for some sink.
If this is not the case, we do not need to render it at all.
- Parameters
-
level | LogLevel. |
channel | Channel name. |
Definition at line 162 of file Logger.h.
◆ mData
std::map<std::string, std::tuple<std::shared_ptr<Sink>, Filter, std::shared_ptr<Formatter> > > carl::logging::Logger::mData |
|
private |
Mapping from channels to associated logging classes.
Definition at line 77 of file Logger.h.
◆ mMutex
std::mutex carl::logging::Logger::mMutex |
|
private |
Logging mutex to ensure thread-safe logging.
Definition at line 79 of file Logger.h.
The documentation for this class was generated from the following file: