From fceabffa45c1331b45f2aac4cb5ce7b4cbb70194 Mon Sep 17 00:00:00 2001 From: Thiago Farina Date: Thu, 3 Mar 2016 10:32:59 -0300 Subject: [PATCH] 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 --- pdns/lua-recursor4.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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}); -- 2.47.2