summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2017-06-21 00:59:03 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2017-06-21 00:59:03 +0100
commit6af9783784f8089e47265566fc93b0d71002e82b (patch)
tree423f9a14676a3dae698243b2667b8af252a98c37
parentSimplify logger[base] constructor (diff)
downloadicetray-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.cpp6
-rw-r--r--icetray/icetray/logger.h2
-rw-r--r--icetray/unittests/testIceTrayLogger.cpp1
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();
}