18#ifndef LOG4CXX_LOGGER_INSTANCE_HDR_
19#define LOG4CXX_LOGGER_INSTANCE_HDR_
48 bool m_hadConfiguration;
55 template <
class StringType>
57 : m_hadConfiguration(
LogManager::exists(instanceName))
58 , m_logger(
LogManager::getLogger(instanceName))
72 explicit operator bool() const noexcept
89 return m_logger.get();
94 return m_logger.get();
100 if (m_logger && !m_hadConfiguration)
102 auto name = m_logger->getName();
108 m_hadConfiguration =
false;
114 template <
class StringType>
115 void reset(
const StringType& instanceName)
Use the LogManager class to retreive Logger instances or to operate on the current LoggerRepository.
Definition logmanager.h:45
static bool removeLogger(const LogString &name, bool ifNotUsed=true)
Remove the name Logger from the LoggerRepository.
static LoggerPtr getLogger(const std::string &name)
Retrieve the name Logger instance from the LoggerRepository using the default factory to create it if...
static LoggerPtr exists(const std::string &name)
A pointer to the Logger name instance if it exists in the LoggerRepository.
LoggerInstancePtr(const StringType &instanceName)
A separately configurable logger named instanceName.
Definition loggerinstance.h:56
Logger * get() noexcept
Definition loggerinstance.h:87
const Logger * get() const noexcept
Definition loggerinstance.h:92
void reset(const StringType &instanceName)
Change this to a logger named instanceName.
Definition loggerinstance.h:115
LoggerInstancePtr()
A null LoggerPtr.
Definition loggerinstance.h:52
const LoggerPtr & operator->() const noexcept
Definition loggerinstance.h:67
~LoggerInstancePtr()
Conditionally remove the logger from the the spi::LoggerRepository.
Definition loggerinstance.h:62
void reset()
Conditionally remove the Logger from the spi::LoggerRepository.
Definition loggerinstance.h:98
This is the central class in the log4cxx package.
Definition log4cxx/logger.h:51
std::shared_ptr< Logger > LoggerPtr
Definition defaultloggerfactory.h:27