util: Add API to enumerate Logger modules

Change-Id: Ie1361b76305b4de9746e769212efa7b381c59f91
Refs: #4013
diff --git a/src/util/logging.cpp b/src/util/logging.cpp
index 89d0fd7..13fd36d 100644
--- a/src/util/logging.cpp
+++ b/src/util/logging.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -23,6 +23,8 @@
 #include "logger.hpp"
 
 #include <boost/log/expressions.hpp>
+#include <boost/range/algorithm/copy.hpp>
+#include <boost/range/adaptor/map.hpp>
 #include <cstdlib>
 #include <fstream>
 
@@ -66,6 +68,16 @@
   logger.setLevel(level);
 }
 
+std::set<std::string>
+Logging::getLoggerNamesImpl()
+{
+  std::lock_guard<std::mutex> lock(m_mutex);
+
+  std::set<std::string> loggerNames;
+  boost::copy(m_loggers | boost::adaptors::map_keys, std::inserter(loggerNames, loggerNames.end()));
+  return loggerNames;
+}
+
 #ifdef NDN_CXX_HAVE_TESTS
 bool
 Logging::removeLogger(Logger& logger)
diff --git a/src/util/logging.hpp b/src/util/logging.hpp
index 45dbe07..459cf2b 100644
--- a/src/util/logging.hpp
+++ b/src/util/logging.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -52,6 +52,11 @@
   static void
   addLogger(Logger& logger);
 
+  /** \brief get list of names of all registered loggers
+   */
+  static std::set<std::string>
+  getLoggerNames();
+
   /** \brief set severity level
    *  \param moduleName logger name, or "*" for default level
    *  \param level minimum severity level
@@ -111,6 +116,9 @@
   void
   addLoggerImpl(Logger& logger);
 
+  std::set<std::string>
+  getLoggerNamesImpl();
+
   void
   setLevelImpl(const std::string& moduleName, LogLevel level);
 
@@ -160,6 +168,12 @@
   get().addLoggerImpl(logger);
 }
 
+inline std::set<std::string>
+Logging::getLoggerNames()
+{
+  return get().getLoggerNamesImpl();
+}
+
 inline void
 Logging::setLevel(const std::string& moduleName, LogLevel level)
 {