Lugdunum  0.1.0
LoggingFacility.cpp
Go to the documentation of this file.
4 
5 namespace lug {
6 namespace System {
7 namespace Logger {
8 
9 static std::unordered_map<std::string, std::unique_ptr<Logger>> loggers{};
10 static std::unordered_map<std::string, std::unique_ptr<Handler>> handlers{};
11 
12 void LoggingFacility::registerLogger(const std::string& loggerName, std::unique_ptr<Logger> logger) {
13  loggers[loggerName] = std::move(logger);
14 }
15 
16 Logger* LoggingFacility::getLogger(const std::string& loggerName) {
17  return loggers[loggerName].get();
18 }
19 
20 void LoggingFacility::registerHandler(const std::string& handlerName, std::unique_ptr<Handler> handler) {
21  handlers[handlerName] = std::move(handler);
22 }
23 
24 Handler* LoggingFacility::getHandler(const std::string& handlerName) {
25  return handlers[handlerName].get();
26 }
27 
29  handlers.clear();
30  loggers.clear();
31 }
32 
33 } // Logger
34 } // System
35 } // lug
static void registerHandler(const std::string &handlerName, std::unique_ptr< Handler > handler)
static std::unordered_map< std::string, std::unique_ptr< Logger > > loggers
static void registerLogger(const std::string &loggerName, std::unique_ptr< Logger > logger)
static Handler * getHandler(const std::string &handlerName)
static Logger * getLogger(const std::string &loggerName)
static std::unordered_map< std::string, std::unique_ptr< Handler > > handlers