From 6af9783784f8089e47265566fc93b0d71002e82b Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 21 Jun 2017 00:59:03 +0100 Subject: Add method for getting the configured domain of a logger --- icetray/icetray/logger.cpp | 6 ++++++ icetray/icetray/logger.h | 2 ++ icetray/unittests/testIceTrayLogger.cpp | 1 + 3 files changed, 9 insertions(+) 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(); } -- cgit v1.2.3