28 #include <ndn-cxx/util/logger.hpp>
29 #include <ndn-cxx/util/logging.hpp>
33 static ndn::util::LogLevel
39 catch (
const std::invalid_argument&) {
40 NDN_THROW_NESTED(
ConfigFile::Error(
"Invalid log level for '" + key +
"' in section 'log'"));
61 auto defaultLevel = ndn::util::LogLevel::INFO;
62 auto item = section.get_child_optional(
"default_level");
68 ndn::util::Logging::setLevel(
"nfd.*", defaultLevel);
71 for (
const auto& i : section) {
72 if (i.first ==
"default_level") {
78 if (i.first.find(
'.') == std::string::npos)
80 ndn::util::Logging::setLevel(
"nfd." + i.first, level);
82 ndn::util::Logging::setLevel(i.first, level);
Configuration file parsing utility.
void addSectionHandler(const std::string §ionName, ConfigSectionHandler subscriber)
Setup notification of configuration file sections.
void setConfigFile(ConfigFile &config)
static ndn::util::LogLevel parseLogLevel(const ConfigSection &item, const std::string &key)
static void onConfig(const ConfigSection §ion, bool isDryRun, const std::string &)
boost::property_tree::ptree ConfigSection
A configuration file section.