}
}
catch (const std::exception& e) {
- errlog("Error generating a DNSCrypt certificate: %s", e.what());
+ SLOG(errlog("Error generating a DNSCrypt certificate: %s", e.what()),
+ dnsdist::logging::getTopLogger()->error(Logr::Error, e.what(), "Error generating a DNSCrypt certificate"));
g_outputBuffer = "Error generating a DNSCrypt certificate: " + string(e.what()) + "\n";
return false;
}
}
}
catch (const std::exception& e) {
- errlog("Error generating a DNSCrypt certificate: %s", e.what());
+ SLOG(errlog("Error generating a DNSCrypt certificate: %s", e.what()),
+ dnsdist::logging::getTopLogger()->error(Logr::Error, e.what(), "Error generating a DNSCrypt certificate"));
g_outputBuffer = "Error generating a DNSCrypt certificate: " + string(e.what()) + "\n";
}
});
g_outputBuffer = "Provider fingerprint is: " + DNSCryptContext::getProviderFingerprint(publicKey) + "\n";
}
catch (const std::exception& e) {
- errlog("Error generating a DNSCrypt provider key: %s", e.what());
+ SLOG(errlog("Error generating a DNSCrypt provider key: %s", e.what()),
+ dnsdist::logging::getTopLogger()->error(Logr::Error, e.what(), "Error generating a DNSCrypt provider key"));
g_outputBuffer = "Error generating a DNSCrypt provider key: " + string(e.what()) + "\n";
}
g_outputBuffer = "Provider fingerprint is: " + DNSCryptContext::getProviderFingerprint(publicKey) + "\n";
}
catch (const std::exception& e) {
- errlog("Error getting a DNSCrypt provider fingerprint: %s", e.what());
+ SLOG(errlog("Error getting a DNSCrypt provider fingerprint: %s", e.what()),
+ dnsdist::logging::getTopLogger()->error(Logr::Error, e.what(), "Error getting a DNSCrypt provider fingerprint"));
g_outputBuffer = "Error getting a DNSCrypt provider fingerprint: " + string(e.what()) + "\n";
}
});
return std::make_shared<dnsdist::NetworkEndpoint>(path);
}
catch (const std::exception& e) {
- warnlog("Error connecting to network endpoint: %s", e.what());
+ SLOG(warnlog("Error connecting to network endpoint: %s", e.what()),
+ dnsdist::logging::getTopLogger()->error(Logr::Error, e.what(), "Error connecting to network endpoint"));
}
return std::shared_ptr<dnsdist::NetworkEndpoint>(nullptr);
});
checkAllParametersConsumed("newPacketCache", vars);
if (maxEntries < settings.d_shardCount) {
- warnlog("The number of entries (%d) in the packet cache is smaller than the number of shards (%d), decreasing the number of shards to %d", maxEntries, settings.d_shardCount, maxEntries);
+ SLOG(warnlog("The number of entries (%d) in the packet cache is smaller than the number of shards (%d), decreasing the number of shards to %d", maxEntries, settings.d_shardCount, maxEntries),
+ dnsdist::logging::getTopLogger()->withName("configuration")->info(Logr::Warning, "The number of entries in the packet cache is smaller than the number of shards, decreasing the number of shards to the number of entries", "number_of_entries", Logging::Loggable(maxEntries), "number_of_shards", Logging::Loggable(settings.d_shardCount)));
g_outputBuffer += "The number of entries (" + std::to_string(maxEntries) + " in the packet cache is smaller than the number of shards (" + std::to_string(settings.d_shardCount) + "), decreasing the number of shards to " + std::to_string(maxEntries);
settings.d_shardCount = maxEntries;
}
void setupLuaBindingsLogging(LuaContext& luaCtx)
{
luaCtx.writeFunction("vinfolog", [](const string& arg) {
- vinfolog("%s", arg);
+ VERBOSESLOG(infolog("%s", arg),
+ dnsdist::logging::getTopLogger()->withName("lua-message")->info(Logr::Info, arg));
});
luaCtx.writeFunction("infolog", [](const string& arg) {
- infolog("%s", arg);
+ SLOG(infolog("%s", arg),
+ dnsdist::logging::getTopLogger()->withName("lua-message")->info(Logr::Info, arg));
});
luaCtx.writeFunction("errlog", [](const string& arg) {
- errlog("%s", arg);
+ SLOG(errlog("%s", arg),
+ dnsdist::logging::getTopLogger()->withName("lua-message")->info(Logr::Error, arg));
});
luaCtx.writeFunction("warnlog", [](const string& arg) {
- warnlog("%s", arg);
+ SLOG(warnlog("%s", arg),
+ dnsdist::logging::getTopLogger()->withName("lua-message")->info(Logr::Warning, arg));
});
luaCtx.writeFunction("show", [](const string& arg) {
g_outputBuffer += arg;
callback(resolvedHostname, result);
}
catch (const std::exception& exp) {
- vinfolog("Error during execution of getAddressInfo callback: %s", exp.what());
+ VERBOSESLOG(infolog("Error during execution of getAddressInfo callback: %s", exp.what()),
+ dnsdist::logging::getTopLogger()->error(Logr::Error, exp.what(), "Error during execution of getAddressInfo callback"));
}
// this _needs_ to be done while we are holding the lock,
// otherwise the destructor will corrupt the stack
{"setProxyProtocolMaximumPayloadSize", {[](dnsdist::configuration::RuntimeConfiguration& config, uint64_t newValue) { config.d_proxyProtocolMaximumSize = std::max(static_cast<uint64_t>(16), newValue); }, std::numeric_limits<uint32_t>::max()}},
{"setPayloadSizeOnSelfGeneratedAnswers", {[](dnsdist::configuration::RuntimeConfiguration& config, uint64_t newValue) {
if (newValue < 512) {
- warnlog("setPayloadSizeOnSelfGeneratedAnswers() is set too low, using 512 instead!");
+ SLOG(warnlog("setPayloadSizeOnSelfGeneratedAnswers() is set too low, using 512 instead!"),
+ dnsdist::logging::getTopLogger()->withName("configuration")->info(Logr::Warning, "Value passed to setPayloadSizeOnSelfGeneratedAnswers() is set too low, using 512 instead", "value", Logging::Loggable(newValue)));
+
g_outputBuffer = "setPayloadSizeOnSelfGeneratedAnswers() is set too low, using 512 instead!";
newValue = 512;
}
if (newValue > dnsdist::configuration::s_udpIncomingBufferSize) {
- warnlog("setPayloadSizeOnSelfGeneratedAnswers() is set too high, capping to %d instead!", dnsdist::configuration::s_udpIncomingBufferSize);
+ SLOG(warnlog("setPayloadSizeOnSelfGeneratedAnswers() is set too high, capping to %d instead!", dnsdist::configuration::s_udpIncomingBufferSize),
+ dnsdist::logging::getTopLogger()->withName("configuration")->info(Logr::Warning, "Value passed to setPayloadSizeOnSelfGeneratedAnswers() is set too high, capping", "value", Logging::Loggable(newValue), "cap", Logging::Loggable(dnsdist::configuration::s_udpIncomingBufferSize)));
g_outputBuffer = "setPayloadSizeOnSelfGeneratedAnswers() is set too high, capping to " + std::to_string(dnsdist::configuration::s_udpIncomingBufferSize) + " instead";
newValue = dnsdist::configuration::s_udpIncomingBufferSize;
}
}
catch (const std::exception& exp) {
g_outputBuffer = name + " cannot be used at runtime!\n";
- errlog("%s cannot be used at runtime!", name);
+ SLOG(errlog("%s cannot be used at runtime!", name),
+ dnsdist::logging::getTopLogger()->withName("configuration")->info(Logr::Error, "The " + name + " directive cannot be used at runtime"));
}
});
}
}
catch (const std::exception& exp) {
g_outputBuffer = name + " cannot be used at runtime!\n";
- errlog("%s cannot be used at runtime!", name);
+ SLOG(errlog("%s cannot be used at runtime!", name),
+ dnsdist::logging::getTopLogger()->withName("configuration")->info(Logr::Error, "The " + name + " directive cannot be used at runtime"));
}
});
}
luaCtx.writeFunction(item.first, [&name = item.first, &item = item.second](double value) {
if (value != 0 && value < item.minimumValue) {
g_outputBuffer = "Invalid value passed to " + name + "()!\n";
- errlog("Invalid value passed to %s()!", name);
+ SLOG(errlog("Invalid value passed to %s()!", name),
+ dnsdist::logging::getTopLogger()->withName("configuration")->info(Logr::Error, "Invalid value passed to " + name, "value", Logging::Loggable(value)));
return;
}
}
catch (const std::exception& exp) {
g_outputBuffer = name + " cannot be used at runtime!\n";
- errlog("%s cannot be used at runtime!", name);
+ SLOG(errlog("%s cannot be used at runtime!", name),
+ dnsdist::logging::getTopLogger()->withName("configuration")->info(Logr::Error, "The " + name + " directive cannot be used at runtime"));
}
setLuaSideEffect();
});