22 #ifndef NDN_CXX_UTIL_LOGGING_HPP
23 #define NDN_CXX_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>
96 setDestination(boost::shared_ptr<boost::log::sinks::sink> destination);
127 addLoggerImpl(
Logger& logger);
130 registerLoggerNameImpl(std::string name);
133 getLoggerNamesImpl()
const;
148 findLevel(std::string moduleName)
const;
151 setLevelImpl(
const std::string& prefix,
LogLevel level);
154 setLevelImpl(
const std::string& config);
157 setDestinationImpl(boost::shared_ptr<boost::log::sinks::sink> sink);
166 #ifdef NDN_CXX_HAVE_TESTS
168 removeLogger(
Logger& logger);
173 boost::shared_ptr<boost::log::sinks::sink>
174 getDestination()
const;
177 setLevelImpl(
const std::unordered_map<std::string, LogLevel>& prefixRules);
179 const std::unordered_map<std::string, LogLevel>&
186 mutable std::mutex m_mutex;
187 std::unordered_map<std::string, LogLevel> m_enabledLevel;
188 std::unordered_multimap<std::string, Logger*> m_loggers;
190 boost::shared_ptr<boost::log::sinks::sink> m_destination;
193 inline std::set<std::string>
196 return get().getLoggerNamesImpl();
202 get().setLevelImpl(prefix, level);
208 get().setLevelImpl(config);
214 get().setDestinationImpl(std::move(destination));
#define NDN_CXX_NODISCARD
Represents a log module in the logging facility.
Controls the logging facility.
static void flush()
Flush log backend.
static void setLevel(const std::string &prefix, LogLevel level)
Set severity level.
static void setDestination(boost::shared_ptr< boost::log::sinks::sink > destination)
Set or replace log destination.
static std::set< std::string > getLoggerNames()
Get list of all registered logger names.
static boost::shared_ptr< boost::log::sinks::sink > makeDefaultStreamDestination(shared_ptr< std::ostream > os, bool wantAutoFlush=true)
Create stream log destination using default formatting.
Common includes and macros used throughout the library.
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
LogLevel
Indicates the severity level of a log message.