22 #ifndef NDN_UTIL_LOGGING_HPP 23 #define NDN_UTIL_LOGGING_HPP 27 #ifdef HAVE_NDN_CXX_CUSTOM_LOGGER 28 #include "ndn-cxx/util/custom-logging.hpp" 31 #include <boost/log/sinks.hpp> 33 #include <unordered_map> 51 static std::set<std::string>
95 setDestination(boost::shared_ptr<boost::log::sinks::sink> destination);
116 static boost::shared_ptr<boost::log::sinks::sink>
123 addLoggerImpl(
Logger& logger);
126 registerLoggerNameImpl(std::string name);
128 std::set<std::string>
129 getLoggerNamesImpl()
const;
144 findLevel(std::string moduleName)
const;
147 setLevelImpl(
const std::string& prefix,
LogLevel level);
150 setLevelImpl(
const std::string& config);
153 setDestinationImpl(boost::shared_ptr<boost::log::sinks::sink> sink);
162 #ifdef NDN_CXX_HAVE_TESTS 164 removeLogger(
Logger& logger);
169 boost::shared_ptr<boost::log::sinks::sink>
170 getDestination()
const;
173 setLevelImpl(
const std::unordered_map<std::string, LogLevel>& prefixRules);
175 const std::unordered_map<std::string, LogLevel>&
177 #endif // NDN_CXX_HAVE_TESTS 182 mutable std::mutex m_mutex;
183 std::unordered_map<std::string, LogLevel> m_enabledLevel;
184 std::unordered_multimap<std::string, Logger*> m_loggers;
186 boost::shared_ptr<boost::log::sinks::sink> m_destination;
189 inline std::set<std::string>
192 return get().getLoggerNamesImpl();
198 get().setLevelImpl(prefix, level);
204 get().setLevelImpl(config);
210 get().setDestinationImpl(
std::move(destination));
222 #endif // HAVE_NDN_CXX_CUSTOM_LOGGER 224 #endif // NDN_UTIL_LOGGING_HPP Controls the logging facility.
static void setLevel(const std::string &prefix, LogLevel level)
Set severity level.
LogLevel
Indicates the severity level of a log message.
Common includes and macros used throughout the library.
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
static void flush()
Flush log backend.
static boost::shared_ptr< boost::log::sinks::sink > makeDefaultStreamDestination(shared_ptr< std::ostream > os)
Create stream log destination using default formatting.
Represents a log module in the logging facility.
static std::set< std::string > getLoggerNames()
Get list of all registered logger names.
static void setDestination(boost::shared_ptr< boost::log::sinks::sink > destination)
Set or replace log destination.