}
catch (const PDNSException& ae) {
SLOG(g_log << Logger::Error << "Exception: " << ae.reason << endl,
- g_slog->withName("config")->error(Logr::Error, ae.reason, "Exception"));
+ g_slog->withName("config")->error(Logr::Critical, ae.reason, "Fatal error", "exception", Logging::Loggable("PDNSException")));
ret = EXIT_FAILURE;
}
catch (const std::exception& e) {
SLOG(g_log << Logger::Error << "STL Exception: " << e.what() << endl,
- g_slog->withName("config")->error(Logr::Error, e.what(), "STL Exception"));
+ g_slog->withName("config")->error(Logr::Critical, e.what(), "Fatal error", "exception", Logging::Loggable("std::exception")));
ret = EXIT_FAILURE;
}
catch (...) {
SLOG(g_log << Logger::Error << "any other exception in main: " << endl,
- g_slog->withName("config")->error(Logr::Error, "Unknown", "Exception"));
+ g_slog->withName("config")->info(Logr::Critical, "Fatal error"));
ret = EXIT_FAILURE;
}
static RecursorControlChannel::Answer* doReloadLuaScript()
{
string fname = ::arg()["lua-dns-script"];
+ auto log = g_slog->withName("runtime")->withValues("name", Logging::Loggable(fname));
try {
if (fname.empty()) {
t_pdl.reset();
- g_log << Logger::Info << RecThreadInfo::id() << " Unloaded current lua script" << endl;
+ SLOG(g_log << Logger::Info << RecThreadInfo::id() << " Unloaded current lua script" << endl,
+ log->info(Logr::Info, "Unloaded current lua script"));
return new RecursorControlChannel::Answer{0, string("unloaded\n")};
}
}
catch (std::runtime_error& ex) {
string msg = std::to_string(RecThreadInfo::id()) + " Retaining current script, could not read '" + fname + "': " + ex.what();
- g_log << Logger::Error << msg << endl;
+ SLOG(g_log << Logger::Error << msg << endl,
+ log->error(Logr::Error, ex.what(), "Retaining current script, could not read new script"));
return new RecursorControlChannel::Answer{1, msg + "\n"};
}
}
catch (std::exception& e) {
- g_log << Logger::Error << RecThreadInfo::id() << " Retaining current script, error from '" << fname << "': " << e.what() << endl;
+ SLOG(g_log << Logger::Error << RecThreadInfo::id() << " Retaining current script, error from '" << fname << "': " << e.what() << endl,
+ log->error(Logr::Error, e.what(), "Retaining current script, error in new script"));
return new RecursorControlChannel::Answer{1, string("retaining current script, error from '" + fname + "': " + e.what() + "\n")};
}
- g_log << Logger::Warning << RecThreadInfo::id() << " (Re)loaded lua script from '" << fname << "'" << endl;
+ SLOG(g_log << Logger::Warning << RecThreadInfo::id() << " (Re)loaded lua script from '" << fname << "'" << endl,
+ log->info(Logr::Warning, "(Re)loaded lua script"));
return new RecursorControlChannel::Answer{0, string("(re)loaded '" + fname + "'\n")};
}
}
}
catch (const std::exception& e) {
- g_log << Logger::Warning << ", failed: " << e.what() << endl;
+ auto log = g_slog->withName("runtime");
+ SLOG(g_log << Logger::Warning << ", failed: " << e.what() << endl,
+ log->error(Logr::Warning, e.what(), "Wipecache failed"));
}
return res;
sr.setRefreshAlmostExpired(false);
bool ex = true;
try {
- log->info(Logr::Warning, "trying DoT");
+ log->info(Logr::Debug, "trying DoT");
bool ok = sr.tryDoT(task.d_qname, QType(task.d_qtype), task.d_nsname, task.d_ip, now.tv_sec);
ex = false;
- log->info(Logr::Warning, "done", "ok", Logging::Loggable(ok));
+ log->info(Logr::Debug, "done", "ok", Logging::Loggable(ok));
}
catch (const std::exception& e) {
log->error(Logr::Error, msg, e.what());