diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2017-06-21 00:59:03 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2017-06-21 00:59:03 +0100 |
commit | 6af9783784f8089e47265566fc93b0d71002e82b (patch) | |
tree | 423f9a14676a3dae698243b2667b8af252a98c37 | |
parent | Simplify logger[base] constructor (diff) | |
download | icetray-6af9783784f8089e47265566fc93b0d71002e82b.tar.bz2 icetray-6af9783784f8089e47265566fc93b0d71002e82b.tar.xz icetray-6af9783784f8089e47265566fc93b0d71002e82b.zip |
Add method for getting the configured domain of a logger
-rw-r--r-- | icetray/icetray/logger.cpp | 6 | ||||
-rw-r--r-- | icetray/icetray/logger.h | 2 | ||||
-rw-r--r-- | icetray/unittests/testIceTrayLogger.cpp | 1 |
3 files changed, 9 insertions, 0 deletions
diff --git a/icetray/icetray/logger.cpp b/icetray/icetray/logger.cpp index 5ee4937..6afe4d8 100644 --- a/icetray/icetray/logger.cpp +++ b/icetray/icetray/logger.cpp @@ -20,6 +20,12 @@ namespace IceTray { { } + const std::string & + LoggerBase::getDomain() const + { + return domain; + } + Logger::Logger(const std::string & domain) : LoggerBase(domain) { } void diff --git a/icetray/icetray/logger.h b/icetray/icetray/logger.h index 123b760..339f7eb 100644 --- a/icetray/icetray/logger.h +++ b/icetray/icetray/logger.h @@ -24,6 +24,8 @@ namespace IceTray { LoggerBase(const std::string & domain); ~LoggerBase(); + const std::string & getDomain() const; + protected: friend class LogManager; mutable boost::shared_mutex _lock; diff --git a/icetray/unittests/testIceTrayLogger.cpp b/icetray/unittests/testIceTrayLogger.cpp index dfd5ae2..e7eb0fc 100644 --- a/icetray/unittests/testIceTrayLogger.cpp +++ b/icetray/unittests/testIceTrayLogger.cpp @@ -277,6 +277,7 @@ BOOST_AUTO_TEST_CASE( getLogger ) this->start("test", ic, {}); auto logger = LOGMANAGER()->getLogger("test.domain"); BOOST_REQUIRE(logger); + BOOST_REQUIRE_EQUAL("test.domain", logger->getDomain()); ic->destroy(); } |