From: Thiago Farina Date: Thu, 3 Mar 2016 13:32:59 +0000 (-0300) Subject: make second argument to pdnslog optional X-Git-Tag: rec-4.0.0-alpha2~13^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F3502%2Fhead;p=thirdparty%2Fpdns.git make second argument to pdnslog optional This patch makes the |loglevel| parameter for pdnslog in Lua, optional. If not specified the default log level will be Warning. Fixes #3487 --- diff --git a/pdns/lua-recursor4.cc b/pdns/lua-recursor4.cc index 1543a7bdae..df22aca8f0 100644 --- a/pdns/lua-recursor4.cc +++ b/pdns/lua-recursor4.cc @@ -339,8 +339,8 @@ RecursorLua4::RecursorLua4(const std::string& fname) d_lw->registerFunction("check",(bool (SuffixMatchNode::*)(const DNSName&) const) &SuffixMatchNode::check); - d_lw->writeFunction("pdnslog", [](const std::string& msg, int loglevel) { - theL() << (Logger::Urgency)loglevel << msg<writeFunction("pdnslog", [](const std::string& msg, boost::optional loglevel) { + theL() << loglevel.get_value_or(Logger::Warning) << msg< > in_t; vector > > pd{ @@ -358,7 +358,7 @@ RecursorLua4::RecursorLua4(const std::string& fname) {"Warning", LOG_WARNING}, {"Error", LOG_ERR} }}); - + for(const auto& n : QType::names) pd.push_back({n.first, n.second}); pd.push_back({"now", &g_now});