Commit cccc20ca authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

[trac744] Update to new logging interface

parent 68c9545b
......@@ -25,6 +25,7 @@
#include <datasrc/cache.h>
#include <datasrc/logger.h>
#include <log/macros.h>
using namespace std;
using namespace isc::dns;
......@@ -212,10 +213,8 @@ HotCacheImpl::HotCacheImpl(int slots, bool enabled) :
// Insert a cache node into the cache
inline void
HotCacheImpl::insert(const CacheNodePtr node) {
if (logger.isDebugEnabled(DBG_TRACE_DATA)) {
logger.debug(DBG_TRACE_DATA, DATASRC_CACHE_INSERT,
node->getRRset()->getName().toText().c_str());
}
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_CACHE_INSERT).
arg(node->getRRset()->getName());
std::map<Question, CacheNodePtr>::const_iterator iter;
iter = map_.find(node->question);
if (iter != map_.end()) {
......@@ -254,10 +253,8 @@ HotCacheImpl::promote(CacheNodePtr node) {
// Remove a node from the LRU list and the map
void
HotCacheImpl::remove(ConstCacheNodePtr node) {
if (logger.isDebugEnabled(DBG_TRACE_DATA)) {
logger.debug(DBG_TRACE_DATA, DATASRC_CACHE_REMOVE,
node->getRRset()->getName().toText().c_str());
}
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_CACHE_REMOVE).
arg(node->getRRset()->getName());
lru_.erase(node->lru_entry_);
map_.erase(node->question);
--count_;
......@@ -314,7 +311,7 @@ HotCache::retrieve(const Name& n, const RRClass& c, const RRType& t,
return (false);
}
logger.debug(DBG_TRACE_DATA, DATASRC_CACHE_LOOKUP, n.toText().c_str());
logger.debug(DBG_TRACE_DATA, DATASRC_CACHE_LOOKUP).arg(n);
std::map<Question, CacheNodePtr>::const_iterator iter;
iter = impl_->map_.find(Question(n, c, t));
......@@ -347,7 +344,7 @@ HotCache::setSlots(const int slots) {
return;
}
logger.info(DATASRC_CACHE_SLOTS, slots);
logger.info(DATASRC_CACHE_SLOTS).arg(slots);
while (impl_->slots_ != 0 && impl_->count_ > impl_->slots_) {
impl_->remove(impl_->lru_.back());
......
......@@ -38,6 +38,8 @@
#include <dns/rrset.h>
#include <dns/rrsetlist.h>
#include <log/macros.h>
#include <cc/data.h>
#define RETERR(x) do { \
......@@ -124,11 +126,8 @@ getAdditional(Query& q, ConstRRsetPtr rrset) {
const Rdata& rd(it->getCurrent());
if (rrset->getType() == RRType::NS()) {
const generic::NS& ns = dynamic_cast<const generic::NS&>(rd);
if (logger.isDebugEnabled(DBG_TRACE_DATA)) {
logger.debug(DBG_TRACE_DATA, DATASRC_QUERY_GET_NS_ADDITIONAL,
ns.getNSName().toText().c_str(),
rrset->getName().toText().c_str());
}
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_QUERY_GET_NS_ADDITIONAL).
arg(ns.getNSName()).arg(rrset->getName());
q.tasks().push(QueryTaskPtr(
new QueryTask(q, ns.getNSName(),
Message::SECTION_ADDITIONAL,
......@@ -136,11 +135,8 @@ getAdditional(Query& q, ConstRRsetPtr rrset) {
QueryTask::GETADDITIONAL)));
} else if (rrset->getType() == RRType::MX()) {
const generic::MX& mx = dynamic_cast<const generic::MX&>(rd);
if (logger.isDebugEnabled(DBG_TRACE_DATA)) {
logger.debug(DBG_TRACE_DATA, DATASRC_QUERY_GET_MX_ADDITIONAL,
mx.getMXName().toText().c_str(),
rrset->getName().toText().c_str());
}
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_QUERY_GET_MX_ADDITIONAL).
arg(mx.getMXName()).arg(rrset->getName());
q.tasks().push(QueryTaskPtr(
new QueryTask(q, mx.getMXName(),
Message::SECTION_ADDITIONAL,
......@@ -154,17 +150,14 @@ getAdditional(Query& q, ConstRRsetPtr rrset) {
// understand DNAME
void
synthesizeCname(QueryTaskPtr task, RRsetPtr rrset, RRsetList& target) {
if (logger.isDebugEnabled(DBG_TRACE_DATA)) {
logger.debug(DBG_TRACE_DATA, DATASRC_QUERY_SYNTH_CNAME,
rrset->getName().toText().c_str());
}
logger.debug(DBG_TRACE_DATA, DATASRC_QUERY_SYNTH_CNAME).
arg(rrset->getName());
RdataIteratorPtr it = rrset->getRdataIterator();
// More than one DNAME RR in the RRset is illegal, so we only have
// to process the first one.
if (it->isLast()) {
logger.error(DATASRC_QUERY_EMPTY_DNAME,
rrset->getName().toText().c_str());
logger.error(DATASRC_QUERY_EMPTY_DNAME).arg(rrset->getName());
return;
}
......@@ -188,24 +181,20 @@ synthesizeCname(QueryTaskPtr task, RRsetPtr rrset, RRsetList& target) {
// to by a CNAME record
void
chaseCname(Query& q, QueryTaskPtr task, RRsetPtr rrset) {
if (logger.isDebugEnabled(DBG_TRACE_DATA)) {
logger.debug(DBG_TRACE_DATA, DATASRC_QUERY_FOLLOW_CNAME,
rrset->getName().toText().c_str());
}
logger.debug(DBG_TRACE_DATA, DATASRC_QUERY_FOLLOW_CNAME).
arg(rrset->getName());
RdataIteratorPtr it = rrset->getRdataIterator();
// More than one CNAME RR in the RRset is illegal, so we only have
// to process the first one.
if (it->isLast()) {
logger.error(DATASRC_QUERY_EMPTY_CNAME,
rrset->getName().toText().c_str());
logger.error(DATASRC_QUERY_EMPTY_CNAME).arg(rrset->getName());
return;
}
// Stop chasing CNAMES after 16 lookups, to prevent loops
if (q.tooMany()) {
logger.error(DATASRC_QUERY_TOO_MANY_CNAMES,
rrset->getName().toText().c_str());
logger.error(DATASRC_QUERY_TOO_MANY_CNAMES).arg(rrset->getName());
return;
}
......@@ -219,10 +208,8 @@ chaseCname(Query& q, QueryTaskPtr task, RRsetPtr rrset) {
// Check the cache for data which can answer the current query task.
bool
checkCache(QueryTask& task, RRsetList& target) {
if (logger.isDebugEnabled(DBG_TRACE_DATA)) {
logger.debug(DBG_TRACE_DATA, DATASRC_QUERY_CHECK_CACHE,
task.qname.toText().c_str(), task.qtype.toText().c_str());
}
logger.debug(DBG_TRACE_DATA, DATASRC_QUERY_CHECK_CACHE).arg(task.qname).
arg(task.qtype);
HotCache& cache = task.q.getCache();
RRsetList rrsets;
RRsetPtr rrset;
......@@ -384,10 +371,8 @@ DataSrc::Result
doQueryTask(QueryTask& task, ZoneInfo& zoneinfo, RRsetList& target) {
HotCache& cache = task.q.getCache();
RRsetPtr rrset;
if (logger.isDebugEnabled(DBG_TRACE_DATA)) {
logger.debug(DBG_TRACE_DATA, DATASRC_DO_QUERY,
task.qname.toText().c_str(), task.qtype.toText().c_str());
}
logger.debug(DBG_TRACE_DATA, DATASRC_DO_QUERY).arg(task.qname).
arg(task.qtype);
// First off, make sure at least we have a matching zone in some data
// source. We must do this before checking the cache, because it can
......@@ -398,10 +383,7 @@ doQueryTask(QueryTask& task, ZoneInfo& zoneinfo, RRsetList& target) {
const Name* const zonename = zoneinfo.getEnclosingZone();
if (ds == NULL) {
task.flags |= DataSrc::NO_SUCH_ZONE;
if (logger.isInfoEnabled()) {
logger.info(DATASRC_QUERY_NO_ZONE, task.qname.toText().c_str(),
task.qclass.toText().c_str());
}
logger.info(DATASRC_QUERY_NO_ZONE).arg(task.qname).arg(task.qclass);
return (DataSrc::SUCCESS);
}
......@@ -423,7 +405,7 @@ doQueryTask(QueryTask& task, ZoneInfo& zoneinfo, RRsetList& target) {
target, task.flags, zonename);
if (result != DataSrc::SUCCESS) {
logger.error(DATASRC_QUERY_SIMPLE_FAIL, unsigned(result));
logger.error(DATASRC_QUERY_SIMPLE_FAIL).arg(result);
return (result);
}
......@@ -450,7 +432,7 @@ doQueryTask(QueryTask& task, ZoneInfo& zoneinfo, RRsetList& target) {
target, task.flags, zonename);
if (result != DataSrc::SUCCESS) {
logger.error(DATASRC_QUERY_AUTH_FAIL, unsigned(result));
logger.error(DATASRC_QUERY_AUTH_FAIL).arg(result);
return (result);
}
......@@ -490,8 +472,8 @@ doQueryTask(QueryTask& task, ZoneInfo& zoneinfo, RRsetList& target) {
if (result != DataSrc::SUCCESS) {
logger.error(task.op == QueryTask::GLUE_QUERY ?
DATASRC_QUERY_GLUE_FAIL : DATASRC_QUERY_NOGLUE_FAIL,
unsigned(result));
DATASRC_QUERY_GLUE_FAIL : DATASRC_QUERY_NOGLUE_FAIL).
arg(result);
return (result);
}
......@@ -522,7 +504,7 @@ doQueryTask(QueryTask& task, ZoneInfo& zoneinfo, RRsetList& target) {
task.flags, zonename);
if (result != DataSrc::SUCCESS) {
logger.error(DATASRC_QUERY_REF_FAIL, unsigned(result));
logger.error(DATASRC_QUERY_REF_FAIL).arg(result);
return (result);
}
......@@ -568,11 +550,8 @@ inline void
addToMessage(Query& q, const Message::Section sect, RRsetPtr rrset,
bool no_dnssec = false)
{
if (logger.isDebugEnabled(DBG_TRACE_DATA)) {
logger.debug(DBG_TRACE_DATA, DATASRC_QUERY_ADD_RRSET,
rrset->getName().toText().c_str(),
rrset->getType().toText().c_str());
}
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_QUERY_ADD_RRSET).
arg(rrset->getName()).arg(rrset->getType());
Message& m = q.message();
if (no_dnssec) {
if (rrset->getType() == RRType::RRSIG() ||
......@@ -629,10 +608,8 @@ refQuery(const Query& q, const Name& name, ZoneInfo& zoneinfo,
// they'll be handled in a normal lookup in the zone.
inline bool
hasDelegation(Query& q, QueryTaskPtr task, ZoneInfo& zoneinfo) {
if (logger.isDebugEnabled(DBG_TRACE_DATA)) {
logger.debug(DBG_TRACE_DATA, DATASRC_QUERY_DELEGATION,
task->qname.toText().c_str());
}
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_QUERY_DELEGATION).
arg(task->qname);
const Name* const zonename = zoneinfo.getEnclosingZone();
if (zonename == NULL) {
......@@ -699,10 +676,7 @@ addSOA(Query& q, ZoneInfo& zoneinfo) {
RRsetList soa;
const Name* const zonename = zoneinfo.getEnclosingZone();
if (logger.isDebugEnabled(DBG_TRACE_DATA)) {
logger.debug(DBG_TRACE_DATA, DATASRC_QUERY_ADD_SOA,
zonename->toText().c_str());
}
logger.debug(DBG_TRACE_DATA, DATASRC_QUERY_ADD_SOA).arg(*zonename);
QueryTask newtask(q, *zonename, RRType::SOA(), QueryTask::SIMPLE_QUERY);
RETERR(doQueryTask(newtask, zoneinfo, soa));
if (newtask.flags != 0) {
......@@ -716,10 +690,7 @@ addSOA(Query& q, ZoneInfo& zoneinfo) {
inline DataSrc::Result
addNSEC(Query& q, const Name& name, ZoneInfo& zoneinfo) {
if (logger.isDebugEnabled(DBG_TRACE_DATA)) {
logger.debug(DBG_TRACE_DATA, DATASRC_QUERY_ADD_NSEC,
name.toText().c_str());
}
logger.debug(DBG_TRACE_DATA, DATASRC_QUERY_ADD_NSEC).arg(name);
RRsetList nsec;
QueryTask newtask(q, name, RRType::NSEC(), QueryTask::SIMPLE_QUERY);
......@@ -736,14 +707,11 @@ inline DataSrc::Result
getNsec3(Query& q, ZoneInfo& zoneinfo, string& hash, RRsetPtr& target) {
const DataSrc* ds = zoneinfo.getDataSource();
const Name* const zonename = zoneinfo.getEnclosingZone();
if (logger.isDebugEnabled(DBG_TRACE_DATA)) {
logger.debug(DBG_TRACE_DATA, DATASRC_QUERY_ADD_NSEC3,
zonename->toText().c_str());
}
logger.debug(DBG_TRACE_DATA, DATASRC_QUERY_ADD_NSEC3).arg(*zonename);
if (ds == NULL) {
q.message().setRcode(Rcode::SERVFAIL());
logger.error(DATASRC_QUERY_NO_DS_NSEC3, zonename->toText().c_str());
logger.error(DATASRC_QUERY_NO_DS_NSEC3).arg(*zonename);
return (DataSrc::ERROR);
}
......@@ -846,8 +814,7 @@ proveNX(Query& q, QueryTaskPtr task, ZoneInfo& zoneinfo, const bool wildcard) {
const DataSrc* ds = zoneinfo.getDataSource();
if (ds == NULL) {
m.setRcode(Rcode::SERVFAIL());
logger.error(DATASRC_QUERY_NO_DS_NSEC,
zonename->toText().c_str());
logger.error(DATASRC_QUERY_NO_DS_NSEC).arg(*zonename);
return (DataSrc::ERROR);
}
ds->findPreviousName(task->qname, nsecname, zonename);
......@@ -876,10 +843,7 @@ proveNX(Query& q, QueryTaskPtr task, ZoneInfo& zoneinfo, const bool wildcard) {
// Attempt a wildcard lookup
inline DataSrc::Result
tryWildcard(Query& q, QueryTaskPtr task, ZoneInfo& zoneinfo, bool& found) {
if (logger.isDebugEnabled(DBG_TRACE_DATA)) {
logger.debug(DBG_TRACE_DATA, DATASRC_QUERY_WILDCARD,
task->qname.toText().c_str());
}
logger.debug(DBG_TRACE_DATA, DATASRC_QUERY_WILDCARD).arg(task->qname);
Message& m = q.message();
DataSrc::Result result;
found = false;
......@@ -933,9 +897,8 @@ tryWildcard(Query& q, QueryTaskPtr task, ZoneInfo& zoneinfo, bool& found) {
result = proveNX(q, task, zoneinfo, true);
if (result != DataSrc::SUCCESS) {
m.setRcode(Rcode::SERVFAIL());
logger.error(DATASRC_QUERY_WILDCARD_PROVENX_FAIL,
task->qname.toText().c_str(),
unsigned(result));
logger.error(DATASRC_QUERY_WILDCARD_PROVENX_FAIL).
arg(task->qname).arg(result);
return (DataSrc::ERROR);
}
}
......@@ -958,9 +921,8 @@ tryWildcard(Query& q, QueryTaskPtr task, ZoneInfo& zoneinfo, bool& found) {
RRsetList auth;
if (!refQuery(q, *zonename, zoneinfo, auth)) {
logger.error(DATASRC_QUERY_WILDCARD_REFERRAL,
task->qname.toText().c_str(),
unsigned(result));
logger.error(DATASRC_QUERY_WILDCARD_REFERRAL).arg(task->qname).
arg(result);
return (DataSrc::ERROR);
}
......@@ -976,11 +938,8 @@ tryWildcard(Query& q, QueryTaskPtr task, ZoneInfo& zoneinfo, bool& found) {
//
void
DataSrc::doQuery(Query& q) {
if (logger.isDebugEnabled(DBG_TRACE_BASIC)) {
logger.debug(DBG_TRACE_BASIC, DATASRC_QUERY_PROCESS,
q.qname().toText().c_str(), q.qtype().toText().c_str(),
q.qclass().toText().c_str());
}
logger.debug(DBG_TRACE_BASIC, DATASRC_QUERY_PROCESS).arg(q.qname()).
arg(q.qclass());
Message& m = q.message();
vector<RRsetPtr> additional;
......@@ -998,9 +957,7 @@ DataSrc::doQuery(Query& q) {
// Can't query directly for RRSIG.
if (task->qtype == RRType::RRSIG()) {
m.setRcode(Rcode::REFUSED());
if (logger.isWarnEnabled()) {
logger.warn(DATASRC_QUERY_RRSIG, task->qname.toText().c_str());
}
logger.warn(DATASRC_QUERY_RRSIG).arg(task->qname);
return;
}
......@@ -1028,7 +985,7 @@ DataSrc::doQuery(Query& q) {
result = doQueryTask(*task, zoneinfo, data);
if (result != SUCCESS) {
m.setRcode(Rcode::SERVFAIL());
logger.error(DATASRC_QUERY_TASK_FAIL, unsigned(result));
logger.error(DATASRC_QUERY_TASK_FAIL).arg(result);
return;
}
......@@ -1080,8 +1037,7 @@ DataSrc::doQuery(Query& q) {
RRsetList auth;
if (!refQuery(q, Name(*zonename), zoneinfo, auth) ||
!findRRsetFromList(auth, RRType::NS())) {
logger.error(DATASRC_QUERY_MISSING_NS,
zonename->toText().c_str());
logger.error(DATASRC_QUERY_MISSING_NS).arg(*zonename);
isc_throw(DataSourceError,
"NS RR not found in " << *zonename << "/" <<
q.qclass());
......@@ -1129,8 +1085,7 @@ DataSrc::doQuery(Query& q) {
m.setHeaderFlag(Message::HEADERFLAG_AA, false);
if (!refQuery(q, task->qname, zoneinfo, auth)) {
m.setRcode(Rcode::SERVFAIL());
logger.error(DATASRC_QUERY_BAD_REFERRAL,
task->qname.toText().c_str());
logger.error(DATASRC_QUERY_BAD_REFERRAL).arg(task->qname);
return;
}
BOOST_FOREACH (RRsetPtr rrset, auth) {
......@@ -1162,8 +1117,7 @@ DataSrc::doQuery(Query& q) {
result = tryWildcard(q, task, zoneinfo, wildcard_found);
if (result != SUCCESS) {
m.setRcode(Rcode::SERVFAIL());
logger.error(DATASRC_QUERY_WILDCARD_FAIL,
task->qname.toText().c_str());
logger.error(DATASRC_QUERY_WILDCARD_FAIL).arg(task->qname);
return;
}
......@@ -1185,8 +1139,7 @@ DataSrc::doQuery(Query& q) {
result = addSOA(q, zoneinfo);
if (result != SUCCESS) {
logger.error(DATASRC_QUERY_MISSING_SOA,
zonename->toText().c_str());
logger.error(DATASRC_QUERY_MISSING_SOA).arg(*zonename);
isc_throw(DataSourceError,
"SOA RR not found in " << *zonename <<
"/" << q.qclass());
......@@ -1203,8 +1156,7 @@ DataSrc::doQuery(Query& q) {
result = proveNX(q, task, zoneinfo, false);
if (result != DataSrc::SUCCESS) {
m.setRcode(Rcode::SERVFAIL());
logger.error(DATASRC_QUERY_PROVENX_FAIL,
task->qname.toText().c_str());
logger.error(DATASRC_QUERY_PROVENX_FAIL).arg(task->qname);
return;
}
}
......@@ -1311,9 +1263,8 @@ void
MetaDataSrc::addDataSrc(ConstDataSrcPtr data_src) {
logger.debug(DBG_TRACE_BASIC, DATASRC_META_ADD);
if (getClass() != RRClass::ANY() && data_src->getClass() != getClass()) {
logger.error(DATASRC_META_ADD_CLASS_MISMATCH,
data_src->getClass().toText().c_str(),
getClass().toText().c_str());
logger.error(DATASRC_META_ADD_CLASS_MISMATCH).
arg(data_src->getClass()).arg(getClass());
isc_throw(Unexpected, "class mismatch");
}
......
......@@ -21,6 +21,7 @@
#include <dns/rrclass.h>
#include <dns/rrsetlist.h>
#include <dns/masterload.h>
#include <log/macros.h>
#include <datasrc/memory_datasrc.h>
#include <datasrc/rbtree.h>
......@@ -95,10 +96,8 @@ struct MemoryZone::MemoryZoneImpl {
l > origin_labels;
--l, wname = wname.split(1)) {
if (wname.isWildcard()) {
if (logger.isDebugEnabled(DBG_TRACE_DATA)) {
logger.debug(DBG_TRACE_DATA, DATASRC_MEM_ADD_WILDCARD,
name.toText().c_str());
}
logger.debug(DBG_TRACE_DATA, DATASRC_MEM_ADD_WILDCARD).
arg(name);
// Ensure a separate level exists for the "wildcarding" name,
// and mark the node as "wild".
DomainNode* node;
......@@ -135,14 +134,13 @@ struct MemoryZone::MemoryZoneImpl {
// (depending on how we support DNSSEC). We should revisit it
// at that point.
if (!domain->empty()) {
logger.error(DATASRC_MEM_CNAME_TO_NONEMPTY,
rrset->getName().toText().c_str());
logger.error(DATASRC_MEM_CNAME_TO_NONEMPTY).
arg(rrset->getName());
isc_throw(AddError, "CNAME can't be added with other data for "
<< rrset->getName());
}
} else if (domain->find(RRType::CNAME()) != domain->end()) {
logger.error(DATASRC_MEM_CNAME_COEXIST,
rrset->getName().toText().c_str());
logger.error(DATASRC_MEM_CNAME_COEXIST).arg(rrset->getName());
isc_throw(AddError, "CNAME and " << rrset->getType() <<
" can't coexist for " << rrset->getName());
}
......@@ -160,8 +158,7 @@ struct MemoryZone::MemoryZoneImpl {
(rrset->getType() == RRType::NS() &&
domain->find(RRType::DNAME()) != domain->end())))
{
logger.error(DATASRC_MEM_DNAME_NS,
rrset->getName().toText().c_str());
logger.error(DATASRC_MEM_DNAME_NS).arg(rrset->getName());
isc_throw(AddError, "DNAME can't coexist with NS in non-apex "
"domain " << rrset->getName());
}
......@@ -183,9 +180,8 @@ struct MemoryZone::MemoryZoneImpl {
// XXX: this is not only for CNAME or DNAME. We should generalize
// this code for all other "singleton RR types" (such as SOA) in a
// separate task.
logger.error(DATASRC_MEM_SINGLETON,
rrset->getName().toText().c_str(),
rrset->getType().toText().c_str());
logger.error(DATASRC_MEM_SINGLETON).arg(rrset->getName()).
arg(rrset->getType());
isc_throw(AddError, "multiple RRs of singleton type for "
<< rrset->getName());
}
......@@ -194,9 +190,8 @@ struct MemoryZone::MemoryZoneImpl {
if (compare.getRelation() != NameComparisonResult::SUPERDOMAIN &&
compare.getRelation() != NameComparisonResult::EQUAL)
{
logger.error(DATASRC_MEM_OUT_OF_ZONE,
rrset->getName().toText().c_str(),
origin_.toText().c_str());
logger.error(DATASRC_MEM_OUT_OF_ZONE).arg(rrset->getName()).
arg(origin_);
isc_throw(OutOfZone, "The name " << rrset->getName() <<
" is not contained in zone " << origin_);
}
......@@ -211,14 +206,12 @@ struct MemoryZone::MemoryZoneImpl {
// behavior.
if (rrset->getName().isWildcard()) {
if (rrset->getType() == RRType::NS()) {
logger.error(DATASRC_MEM_WILDCARD_NS,
rrset->getName().toText().c_str());
logger.error(DATASRC_MEM_WILDCARD_NS).arg(rrset->getName());
isc_throw(AddError, "Invalid NS owner name (wildcard): " <<
rrset->getName());
}
if (rrset->getType() == RRType::DNAME()) {
logger.error(DATASRC_MEM_WILDCARD_DNAME,
rrset->getName().toText().c_str());
logger.error(DATASRC_MEM_WILDCARD_DNAME).arg(rrset->getName());
isc_throw(AddError, "Invalid DNAME owner name (wildcard): " <<
rrset->getName());
}
......@@ -231,12 +224,8 @@ struct MemoryZone::MemoryZoneImpl {
*/
// Implementation of MemoryZone::add
result::Result add(const ConstRRsetPtr& rrset, DomainTree* domains) {
if (logger.isDebugEnabled(DBG_TRACE_DATA)) {
logger.debug(DBG_TRACE_DATA, DATASRC_MEM_ADD_RRSET,
rrset->getName().toText().c_str(),
rrset->getType().toText().c_str(),
origin_.toText().c_str());
}
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_MEM_ADD_RRSET).
arg(rrset->getName()).arg(rrset->getType()).arg(origin_);
// Sanitize input
addValidation(rrset);
......@@ -298,9 +287,8 @@ struct MemoryZone::MemoryZoneImpl {
void addFromLoad(const ConstRRsetPtr& set, DomainTree* domains) {
switch (add(set, domains)) {
case result::EXIST:
logger.error(DATASRC_MEM_DUP_RRSET,
set->getName().toText().c_str(),
set->getType().toText().c_str());
logger.error(DATASRC_MEM_DUP_RRSET).arg(set->getName()).
arg(set->getType());
isc_throw(dns::MasterLoadError, "Duplicate rrset: " <<
set->toText());
case result::SUCCESS:
......@@ -396,11 +384,8 @@ struct MemoryZone::MemoryZoneImpl {
rrset, bool rename)
{
if (rename) {
if (logger.isDebugEnabled(DBG_TRACE_DETAILED)) {
logger.debug(DBG_TRACE_DETAILED, DATASRC_MEM_RENAME,
rrset->getName().toText().c_str(),
name.toText().c_str());
}
logger.debug(DBG_TRACE_DETAILED, DATASRC_MEM_RENAME).
arg(rrset->getName()).arg(name);
/*
* We lose a signature here. But it would be wrong anyway, because
* the name changed. This might turn out to be unimportant in
......@@ -423,10 +408,7 @@ struct MemoryZone::MemoryZoneImpl {
FindResult find(const Name& name, RRType type,
RRsetList* target, const FindOptions options) const
{
if (logger.isDebugEnabled(DBG_TRACE_BASIC)) {
logger.debug(DBG_TRACE_BASIC, DATASRC_MEM_FIND,
name.toText().c_str(), type.toText().c_str());
}
logger.debug(DBG_TRACE_BASIC, DATASRC_MEM_FIND).arg(name).arg(type);
// Get the node
DomainNode* node(NULL);
FindState state(options);
......@@ -453,20 +435,16 @@ struct MemoryZone::MemoryZoneImpl {
* is NULL.
*/
if (state.dname_node_ != NULL) {
if (logger.isDebugEnabled(DBG_TRACE_DATA)) {
logger.debug(DBG_TRACE_DATA, DATASRC_MEM_DNAME_FOUND,
state.rrset_->getName().toText().c_str());
}
logger.debug(DBG_TRACE_DATA, DATASRC_MEM_DNAME_FOUND).
arg(state.rrset_->getName());
// We were traversing a DNAME node (and wanted to go
// lower below it), so return the DNAME
return (FindResult(DNAME, prepareRRset(name, state.rrset_,
rename)));
}
if (state.zonecut_node_ != NULL) {
if (logger.isDebugEnabled(DBG_TRACE_DATA)) {
logger.debug(DBG_TRACE_DATA, DATASRC_MEM_DELEG_FOUND,
state.rrset_->getName().toText().c_str());
}
logger.debug(DBG_TRACE_DATA, DATASRC_MEM_DELEG_FOUND).
arg(state.rrset_->getName());
return (FindResult(DELEGATION, prepareRRset(name,
state.rrset_, rename)));
}
......@@ -605,19 +583,13 @@ struct MemoryZone::MemoryZoneImpl {
MemoryZone::MemoryZone(const RRClass& zone_class, const Name& origin) :
impl_(new MemoryZoneImpl(zone_class, origin))
{
if (logger.isDebugEnabled(DBG_TRACE_BASIC)) {
logger.debug(DBG_TRACE_BASIC, DATASRC_MEM_CREATE,
origin.toText().c_str(),
zone_class.toText().c_str());
}
logger.debug(DBG_TRACE_BASIC, DATASRC_MEM_CREATE).arg(origin).
arg(zone_class);
}
MemoryZone::~MemoryZone() {
if (logger.isDebugEnabled(DBG_TRACE_BASIC)) {
logger.debug(DBG_TRACE_BASIC, DATASRC_MEM_DESTROY,
getOrigin().toText().c_str(),
getClass().toText().c_str());
}
logger.debug(DBG_TRACE_BASIC, DATASRC_MEM_DESTROY).arg(getOrigin()).
arg(getClass());
delete impl_;
}
......@@ -646,11 +618,8 @@ MemoryZone::add(const ConstRRsetPtr& rrset) {
void
MemoryZone::load(const string& filename) {
if (logger.isDebugEnabled(DBG_TRACE_BASIC)) {
logger.debug(DBG_TRACE_BASIC, DATASRC_MEM_LOAD,
getOrigin().toText().c_str(),
filename.c_str());
}
logger.debug(DBG_TRACE_BASIC, DATASRC_MEM_LOAD).arg(getOrigin()).
arg(filename);
// Load it into a temporary tree
MemoryZoneImpl::DomainTree tmp;
masterLoad(filename.c_str(), getOrigin(), getClass(),
......@@ -663,11 +632,8 @@ MemoryZone::load(const string& filename) {