Commit 9df5e254 authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

[trac744] Unify to LOG_ macros

parent 8d9debda
......@@ -25,7 +25,6 @@
#include <datasrc/cache.h>
#include <datasrc/logger.h>
#include <log/macros.h>
using namespace std;
using namespace isc::dns;
......@@ -207,7 +206,7 @@ public:
HotCacheImpl::HotCacheImpl(int slots, bool enabled) :
enabled_(enabled), slots_(slots), count_(0)
{
logger.debug(DBG_TRACE_BASIC, DATASRC_CACHE_CREATE);
LOG_DEBUG(logger, DBG_TRACE_BASIC, DATASRC_CACHE_CREATE);
}
// Insert a cache node into the cache
......@@ -220,7 +219,7 @@ HotCacheImpl::insert(const CacheNodePtr node) {
if (iter != map_.end()) {
CacheNodePtr old = iter->second;
if (old && old->isValid()) {
logger.debug(DBG_TRACE_DATA, DATASRC_CACHE_OLD_FOUND);
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_CACHE_OLD_FOUND);
remove(old);
}
}
......@@ -232,7 +231,7 @@ HotCacheImpl::insert(const CacheNodePtr node) {
++count_;
if (slots_ != 0 && count_ > slots_) {
logger.debug(DBG_TRACE_DATA, DATASRC_CACHE_FULL);
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_CACHE_FULL);
remove(lru_.back());
}
}
......@@ -267,7 +266,7 @@ HotCache::HotCache(const int slots) {
// HotCache destructor
HotCache::~HotCache() {
logger.debug(DBG_TRACE_BASIC, DATASRC_CACHE_DESTROY);
LOG_DEBUG(logger, DBG_TRACE_BASIC, DATASRC_CACHE_DESTROY);
delete impl_;
}
......@@ -314,21 +313,21 @@ HotCache::retrieve(const Name& n, const RRClass& c, const RRType& t,
std::map<Question, CacheNodePtr>::const_iterator iter;
iter = impl_->map_.find(Question(n, c, t));
if (iter == impl_->map_.end()) {
logger.debug(DBG_TRACE_DATA, DATASRC_CACHE_NOT_FOUND).arg(n);
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_CACHE_NOT_FOUND).arg(n);
return (false);
}
CacheNodePtr node = iter->second;
if (node->isValid()) {
logger.debug(DBG_TRACE_DATA, DATASRC_CACHE_FOUND).arg(n);
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_CACHE_FOUND).arg(n);
impl_->promote(node);
rrset = node->getRRset();
flags = node->getFlags();
return (true);
}
logger.debug(DBG_TRACE_DATA, DATASRC_CACHE_EXPIRED).arg(n);
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_CACHE_EXPIRED).arg(n);
impl_->remove(node);
return (false);
}
......
......@@ -38,8 +38,6 @@
#include <dns/rrset.h>
#include <dns/rrsetlist.h>
#include <log/macros.h>
#include <cc/data.h>
#define RETERR(x) do { \
......@@ -150,7 +148,7 @@ getAdditional(Query& q, ConstRRsetPtr rrset) {
// understand DNAME
void
synthesizeCname(QueryTaskPtr task, RRsetPtr rrset, RRsetList& target) {
logger.debug(DBG_TRACE_DATA, DATASRC_QUERY_SYNTH_CNAME).
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_QUERY_SYNTH_CNAME).
arg(rrset->getName());
RdataIteratorPtr it = rrset->getRdataIterator();
......@@ -181,7 +179,7 @@ synthesizeCname(QueryTaskPtr task, RRsetPtr rrset, RRsetList& target) {
// to by a CNAME record
void
chaseCname(Query& q, QueryTaskPtr task, RRsetPtr rrset) {
logger.debug(DBG_TRACE_DATA, DATASRC_QUERY_FOLLOW_CNAME).
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_QUERY_FOLLOW_CNAME).
arg(rrset->getName());
RdataIteratorPtr it = rrset->getRdataIterator();
......@@ -208,8 +206,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) {
logger.debug(DBG_TRACE_DATA, DATASRC_QUERY_CHECK_CACHE).arg(task.qname).
arg(task.qtype);
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_QUERY_CHECK_CACHE).
arg(task.qname).arg(task.qtype);
HotCache& cache = task.q.getCache();
RRsetList rrsets;
RRsetPtr rrset;
......@@ -222,8 +220,9 @@ checkCache(QueryTask& task, RRsetList& target) {
// ANY queries must be handled by the low-level data source,
// or the results won't be guaranteed to be complete
if (task.qtype == RRType::ANY() || task.qclass == RRClass::ANY()) {
logger.debug(DBG_TRACE_DATA, DATASRC_QUERY_NO_CACHE_ANY_SIMPLE).
arg(task.qname).arg(task.qtype).arg(task.qclass);
LOG_DEBUG(logger, DBG_TRACE_DATA,
DATASRC_QUERY_NO_CACHE_ANY_SIMPLE).arg(task.qname).
arg(task.qtype).arg(task.qclass);
break;
}
......@@ -253,7 +252,7 @@ checkCache(QueryTask& task, RRsetList& target) {
case QueryTask::AUTH_QUERY: // Find exact RRset or CNAME
if (task.qtype == RRType::ANY() || task.qclass == RRClass::ANY()) {
logger.debug(DBG_TRACE_DATA, DATASRC_QUERY_NO_CACHE_ANY_AUTH).
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_QUERY_NO_CACHE_ANY_AUTH).
arg(task.qname).arg(task.qtype).arg(task.qclass);
break;
}
......@@ -373,7 +372,7 @@ DataSrc::Result
doQueryTask(QueryTask& task, ZoneInfo& zoneinfo, RRsetList& target) {
HotCache& cache = task.q.getCache();
RRsetPtr rrset;
logger.debug(DBG_TRACE_DATA, DATASRC_DO_QUERY).arg(task.qname).
LOG_DEBUG(logger, 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
......@@ -391,8 +390,8 @@ doQueryTask(QueryTask& task, ZoneInfo& zoneinfo, RRsetList& target) {
// Then check the cache for matching data
if (checkCache(task, target)) {
logger.debug(DBG_TRACE_DATA, DATASRC_QUERY_CACHED).arg(task.qname).
arg(task.qtype);
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_QUERY_CACHED).
arg(task.qname).arg(task.qtype);
return (DataSrc::SUCCESS);
}
......@@ -403,8 +402,8 @@ doQueryTask(QueryTask& task, ZoneInfo& zoneinfo, RRsetList& target) {
DataSrc::Result result;
switch (task.op) {
case QueryTask::SIMPLE_QUERY:
logger.debug(DBG_TRACE_DATA, DATASRC_QUERY_IS_SIMPLE).arg(task.qname).
arg(task.qtype);
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_QUERY_IS_SIMPLE).
arg(task.qname).arg(task.qtype);
result = ds->findExactRRset(task.qname, task.qclass, task.qtype,
target, task.flags, zonename);
......@@ -431,8 +430,8 @@ doQueryTask(QueryTask& task, ZoneInfo& zoneinfo, RRsetList& target) {
return (result);
case QueryTask::AUTH_QUERY:
logger.debug(DBG_TRACE_DATA, DATASRC_QUERY_IS_AUTH).arg(task.qname).
arg(task.qtype);
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_QUERY_IS_AUTH).
arg(task.qname).arg(task.qtype);
result = ds->findRRset(task.qname, task.qclass, task.qtype,
target, task.flags, zonename);
......@@ -470,7 +469,7 @@ doQueryTask(QueryTask& task, ZoneInfo& zoneinfo, RRsetList& target) {
case QueryTask::GLUE_QUERY:
case QueryTask::NOGLUE_QUERY:
logger.debug(DBG_TRACE_DATA, task.op == QueryTask::GLUE_QUERY ?
LOG_DEBUG(logger, DBG_TRACE_DATA, task.op == QueryTask::GLUE_QUERY ?
DATASRC_QUERY_IS_GLUE : DATASRC_QUERY_IS_NOGLUE).
arg(task.qname).arg(task.qtype);
result = ds->findAddrs(task.qname, task.qclass, target,
......@@ -505,8 +504,8 @@ doQueryTask(QueryTask& task, ZoneInfo& zoneinfo, RRsetList& target) {
return (result);
case QueryTask::REF_QUERY:
logger.debug(DBG_TRACE_DATA, DATASRC_QUERY_IS_REF).arg(task.qname).
arg(task.qtype);
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_QUERY_IS_REF).
arg(task.qname).arg(task.qtype);
result = ds->findReferral(task.qname, task.qclass, target,
task.flags, zonename);
......@@ -577,7 +576,7 @@ addToMessage(Query& q, const Message::Section sect, RRsetPtr rrset,
// Copy referral information into the authority section of a message
inline void
copyAuth(Query& q, RRsetList& auth) {
logger.debug(DBG_TRACE_DATA, DATASRC_QUERY_COPY_AUTH);
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_QUERY_COPY_AUTH);
BOOST_FOREACH(RRsetPtr rrset, auth) {
if (rrset->getType() == RRType::DNAME()) {
continue;
......@@ -683,7 +682,7 @@ addSOA(Query& q, ZoneInfo& zoneinfo) {
RRsetList soa;
const Name* const zonename = zoneinfo.getEnclosingZone();
logger.debug(DBG_TRACE_DATA, DATASRC_QUERY_ADD_SOA).arg(*zonename);
LOG_DEBUG(logger, 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) {
......@@ -697,7 +696,7 @@ addSOA(Query& q, ZoneInfo& zoneinfo) {
inline DataSrc::Result
addNSEC(Query& q, const Name& name, ZoneInfo& zoneinfo) {
logger.debug(DBG_TRACE_DATA, DATASRC_QUERY_ADD_NSEC).arg(name);
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_QUERY_ADD_NSEC).arg(name);
RRsetList nsec;
QueryTask newtask(q, name, RRType::NSEC(), QueryTask::SIMPLE_QUERY);
......@@ -714,7 +713,7 @@ inline DataSrc::Result
getNsec3(Query& q, ZoneInfo& zoneinfo, string& hash, RRsetPtr& target) {
const DataSrc* ds = zoneinfo.getDataSource();
const Name* const zonename = zoneinfo.getEnclosingZone();
logger.debug(DBG_TRACE_DATA, DATASRC_QUERY_ADD_NSEC3).arg(*zonename);
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_QUERY_ADD_NSEC3).arg(*zonename);
if (ds == NULL) {
q.message().setRcode(Rcode::SERVFAIL());
......@@ -850,7 +849,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) {
logger.debug(DBG_TRACE_DATA, DATASRC_QUERY_WILDCARD).arg(task->qname);
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_QUERY_WILDCARD).arg(task->qname);
Message& m = q.message();
DataSrc::Result result;
found = false;
......@@ -945,7 +944,7 @@ tryWildcard(Query& q, QueryTaskPtr task, ZoneInfo& zoneinfo, bool& found) {
//
void
DataSrc::doQuery(Query& q) {
logger.debug(DBG_TRACE_BASIC, DATASRC_QUERY_PROCESS).arg(q.qname()).
LOG_DEBUG(logger, DBG_TRACE_BASIC, DATASRC_QUERY_PROCESS).arg(q.qname()).
arg(q.qclass());
Message& m = q.message();
vector<RRsetPtr> additional;
......@@ -1268,7 +1267,7 @@ DataSrc::findReferral(const Name& qname, const RRClass& qclass,
void
MetaDataSrc::addDataSrc(ConstDataSrcPtr data_src) {
logger.debug(DBG_TRACE_BASIC, DATASRC_META_ADD);
LOG_DEBUG(logger, DBG_TRACE_BASIC, DATASRC_META_ADD);
if (getClass() != RRClass::ANY() && data_src->getClass() != getClass()) {
logger.error(DATASRC_META_ADD_CLASS_MISMATCH).
arg(data_src->getClass()).arg(getClass());
......@@ -1280,7 +1279,7 @@ MetaDataSrc::addDataSrc(ConstDataSrcPtr data_src) {
void
MetaDataSrc::removeDataSrc(ConstDataSrcPtr data_src) {
logger.debug(DBG_TRACE_BASIC, DATASRC_META_REMOVE);
LOG_DEBUG(logger, DBG_TRACE_BASIC, DATASRC_META_REMOVE);
std::vector<ConstDataSrcPtr>::iterator it, itr;
for (it = data_sources.begin(); it != data_sources.end(); ++it) {
if (*it == data_src) {
......
......@@ -15,7 +15,7 @@
#ifndef __DATASRC_LOGGER_H
#define __DATASRC_LOGGER_H
#include <log/logger.h>
#include <log/macros.h>
#include <datasrc/messagedef.h>
/// \file logger.h
......
......@@ -21,7 +21,6 @@
#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>
......@@ -96,7 +95,7 @@ struct MemoryZone::MemoryZoneImpl {
l > origin_labels;
--l, wname = wname.split(1)) {
if (wname.isWildcard()) {
logger.debug(DBG_TRACE_DATA, DATASRC_MEM_ADD_WILDCARD).
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_MEM_ADD_WILDCARD).
arg(name);
// Ensure a separate level exists for the "wildcarding" name,
// and mark the node as "wild".
......@@ -134,13 +133,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).
LOG_ERROR(logger, 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).arg(rrset->getName());
LOG_ERROR(logger, DATASRC_MEM_CNAME_COEXIST).arg(rrset->getName());
isc_throw(AddError, "CNAME and " << rrset->getType() <<
" can't coexist for " << rrset->getName());
}
......@@ -158,7 +157,7 @@ struct MemoryZone::MemoryZoneImpl {
(rrset->getType() == RRType::NS() &&
domain->find(RRType::DNAME()) != domain->end())))
{
logger.error(DATASRC_MEM_DNAME_NS).arg(rrset->getName());
LOG_ERROR(logger, DATASRC_MEM_DNAME_NS).arg(rrset->getName());
isc_throw(AddError, "DNAME can't coexist with NS in non-apex "
"domain " << rrset->getName());
}
......@@ -180,7 +179,7 @@ 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).arg(rrset->getName()).
LOG_ERROR(logger, DATASRC_MEM_SINGLETON).arg(rrset->getName()).
arg(rrset->getType());
isc_throw(AddError, "multiple RRs of singleton type for "
<< rrset->getName());
......@@ -190,7 +189,7 @@ struct MemoryZone::MemoryZoneImpl {
if (compare.getRelation() != NameComparisonResult::SUPERDOMAIN &&
compare.getRelation() != NameComparisonResult::EQUAL)
{
logger.error(DATASRC_MEM_OUT_OF_ZONE).arg(rrset->getName()).
LOG_ERROR(logger, DATASRC_MEM_OUT_OF_ZONE).arg(rrset->getName()).
arg(origin_);
isc_throw(OutOfZone, "The name " << rrset->getName() <<
" is not contained in zone " << origin_);
......@@ -206,12 +205,14 @@ struct MemoryZone::MemoryZoneImpl {
// behavior.
if (rrset->getName().isWildcard()) {
if (rrset->getType() == RRType::NS()) {
logger.error(DATASRC_MEM_WILDCARD_NS).arg(rrset->getName());
LOG_ERROR(logger, 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).arg(rrset->getName());
LOG_ERROR(logger, DATASRC_MEM_WILDCARD_DNAME).
arg(rrset->getName());
isc_throw(AddError, "Invalid DNAME owner name (wildcard): " <<
rrset->getName());
}
......@@ -287,8 +288,8 @@ struct MemoryZone::MemoryZoneImpl {
void addFromLoad(const ConstRRsetPtr& set, DomainTree* domains) {
switch (add(set, domains)) {
case result::EXIST:
logger.error(DATASRC_MEM_DUP_RRSET).arg(set->getName()).
arg(set->getType());
LOG_ERROR(logger, DATASRC_MEM_DUP_RRSET).
arg(set->getName()).arg(set->getType());
isc_throw(dns::MasterLoadError, "Duplicate rrset: " <<
set->toText());
case result::SUCCESS:
......@@ -325,7 +326,8 @@ struct MemoryZone::MemoryZoneImpl {
const Domain::const_iterator foundDNAME(node.getData()->find(
RRType::DNAME()));
if (foundDNAME != node.getData()->end()) {
logger.debug(DBG_TRACE_DETAILED, DATASRC_MEM_DNAME_ENCOUNTERED);
LOG_DEBUG(logger, DBG_TRACE_DETAILED,
DATASRC_MEM_DNAME_ENCOUNTERED);
state->dname_node_ = &node;
state->rrset_ = foundDNAME->second;
// No more processing below the DNAME (RFC 2672, section 3
......@@ -347,7 +349,7 @@ struct MemoryZone::MemoryZoneImpl {
return (false);
}
logger.debug(DBG_TRACE_DETAILED, DATASRC_MEM_NS_ENCOUNTERED);
LOG_DEBUG(logger, DBG_TRACE_DETAILED, DATASRC_MEM_NS_ENCOUNTERED);
// BIND 9 checks if this node is not the origin. That's probably
// because it can support multiple versions for dynamic updates
......@@ -384,7 +386,7 @@ struct MemoryZone::MemoryZoneImpl {
rrset, bool rename)
{
if (rename) {
logger.debug(DBG_TRACE_DETAILED, DATASRC_MEM_RENAME).
LOG_DEBUG(logger, DBG_TRACE_DETAILED, DATASRC_MEM_RENAME).
arg(rrset->getName()).arg(name);
/*
* We lose a signature here. But it would be wrong anyway, because
......@@ -408,7 +410,8 @@ struct MemoryZone::MemoryZoneImpl {
FindResult find(const Name& name, RRType type,
RRsetList* target, const FindOptions options) const
{
logger.debug(DBG_TRACE_BASIC, DATASRC_MEM_FIND).arg(name).arg(type);
LOG_DEBUG(logger, DBG_TRACE_BASIC, DATASRC_MEM_FIND).arg(name).
arg(type);
// Get the node
DomainNode* node(NULL);
FindState state(options);
......@@ -435,7 +438,7 @@ struct MemoryZone::MemoryZoneImpl {
* is NULL.
*/
if (state.dname_node_ != NULL) {
logger.debug(DBG_TRACE_DATA, DATASRC_MEM_DNAME_FOUND).
LOG_DEBUG(logger, 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
......@@ -443,7 +446,7 @@ struct MemoryZone::MemoryZoneImpl {
rename)));
}
if (state.zonecut_node_ != NULL) {
logger.debug(DBG_TRACE_DATA, DATASRC_MEM_DELEG_FOUND).
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_MEM_DELEG_FOUND).
arg(state.rrset_->getName());
return (FindResult(DELEGATION, prepareRRset(name,
state.rrset_, rename)));
......@@ -493,7 +496,7 @@ struct MemoryZone::MemoryZoneImpl {
if (node_path.getLastComparisonResult().getRelation() ==
NameComparisonResult::COMMONANCESTOR && node_path.
getLastComparisonResult().getCommonLabels() > 1) {
logger.debug(DBG_TRACE_DATA,
LOG_DEBUG(logger, DBG_TRACE_DATA,
DATASRC_MEM_WILDCARD_CANCEL).arg(name);
return (FindResult(NXDOMAIN, ConstRRsetPtr()));
}
......@@ -517,7 +520,8 @@ struct MemoryZone::MemoryZoneImpl {
// fall through
case DomainTree::NOTFOUND:
logger.debug(DBG_TRACE_DATA, DATASRC_MEM_NOTFOUND).arg(name);
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_MEM_NOTFOUND).
arg(name);
return (FindResult(NXDOMAIN, ConstRRsetPtr()));
case DomainTree::EXACTMATCH: // This one is OK, handle it
break;
......@@ -529,7 +533,8 @@ struct MemoryZone::MemoryZoneImpl {
// If there is an exact match but the node is empty, it's equivalent
// to NXRRSET.
if (node->isEmpty()) {
logger.debug(DBG_TRACE_DATA, DATASRC_MEM_DOMAIN_EMPTY).arg(name);
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_MEM_DOMAIN_EMPTY).
arg(name);
return (FindResult(NXRRSET, ConstRRsetPtr()));
}
......@@ -540,8 +545,8 @@ struct MemoryZone::MemoryZoneImpl {
if (node->getFlag(DomainNode::FLAG_CALLBACK) && node != origin_data_) {
found = node->getData()->find(RRType::NS());
if (found != node->getData()->end()) {
logger.debug(DBG_TRACE_DATA, DATASRC_MEM_EXACT_DELEGATION).
arg(name);
LOG_DEBUG(logger, DBG_TRACE_DATA,
DATASRC_MEM_EXACT_DELEGATION).arg(name);
return (FindResult(DELEGATION, prepareRRset(name,
found->second, rename)));
}
......@@ -557,14 +562,15 @@ struct MemoryZone::MemoryZoneImpl {
boost::const_pointer_cast<RRset>(prepareRRset(name,
found->second, rename)));
}
logger.debug(DBG_TRACE_DATA, DATASRC_MEM_ANY_SUCCESS).arg(name);
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_MEM_ANY_SUCCESS).
arg(name);
return (FindResult(SUCCESS, ConstRRsetPtr()));
}
found = node->getData()->find(type);
if (found != node->getData()->end()) {
// Good, it is here
logger.debug(DBG_TRACE_DATA, DATASRC_MEM_SUCCESS).arg(name).
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_MEM_SUCCESS).arg(name).
arg(type);
return (FindResult(SUCCESS, prepareRRset(name, found->second,
rename)));
......@@ -572,13 +578,14 @@ struct MemoryZone::MemoryZoneImpl {
// Next, try CNAME.
found = node->getData()->find(RRType::CNAME());
if (found != node->getData()->end()) {
logger.debug(DBG_TRACE_DATA, DATASRC_MEM_CNAME).arg(name);
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_MEM_CNAME).arg(name);
return (FindResult(CNAME, prepareRRset(name, found->second,
rename)));
}
}
// No exact match or CNAME. Return NXRRSET.
logger.debug(DBG_TRACE_DATA, DATASRC_MEM_NXRRSET).arg(type).arg(name);
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_MEM_NXRRSET).arg(type).
arg(name);
return (FindResult(NXRRSET, ConstRRsetPtr()));
}
};
......@@ -586,12 +593,12 @@ struct MemoryZone::MemoryZoneImpl {
MemoryZone::MemoryZone(const RRClass& zone_class, const Name& origin) :
impl_(new MemoryZoneImpl(zone_class, origin))
{
logger.debug(DBG_TRACE_BASIC, DATASRC_MEM_CREATE).arg(origin).
LOG_DEBUG(logger, DBG_TRACE_BASIC, DATASRC_MEM_CREATE).arg(origin).
arg(zone_class);
}
MemoryZone::~MemoryZone() {
logger.debug(DBG_TRACE_BASIC, DATASRC_MEM_DESTROY).arg(getOrigin()).
LOG_DEBUG(logger, DBG_TRACE_BASIC, DATASRC_MEM_DESTROY).arg(getOrigin()).
arg(getClass());
delete impl_;
}
......@@ -621,7 +628,7 @@ MemoryZone::add(const ConstRRsetPtr& rrset) {
void
MemoryZone::load(const string& filename) {
logger.debug(DBG_TRACE_BASIC, DATASRC_MEM_LOAD).arg(getOrigin()).
LOG_DEBUG(logger, DBG_TRACE_BASIC, DATASRC_MEM_LOAD).arg(getOrigin()).
arg(filename);
// Load it into a temporary tree
MemoryZoneImpl::DomainTree tmp;
......@@ -635,7 +642,7 @@ MemoryZone::load(const string& filename) {
void
MemoryZone::swap(MemoryZone& zone) {
logger.debug(DBG_TRACE_BASIC, DATASRC_MEM_SWAP).arg(getOrigin()).
LOG_DEBUG(logger, DBG_TRACE_BASIC, DATASRC_MEM_SWAP).arg(getOrigin()).
arg(zone.getOrigin());
std::swap(impl_, zone.impl_);
}
......@@ -677,8 +684,8 @@ MemoryDataSrc::addZone(ZonePtr zone) {
"Null pointer is passed to MemoryDataSrc::addZone()");
}
logger.debug(DBG_TRACE_BASIC, DATASRC_MEM_ADD_ZONE).arg(zone->getOrigin()).
arg(zone->getClass().toText());
LOG_DEBUG(logger, DBG_TRACE_BASIC, DATASRC_MEM_ADD_ZONE).
arg(zone->getOrigin()).arg(zone->getClass().toText());
const result::Result result = impl_->zone_table.addZone(zone);
if (result == result::SUCCESS) {
......@@ -689,7 +696,7 @@ MemoryDataSrc::addZone(ZonePtr zone) {
MemoryDataSrc::FindResult
MemoryDataSrc::findZone(const isc::dns::Name& name) const {
logger.debug(DBG_TRACE_DATA, DATASRC_MEM_FIND_ZONE).arg(name);
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_MEM_FIND_ZONE).arg(name);
return (FindResult(impl_->zone_table.findZone(name).code,
impl_->zone_table.findZone(name).zone));
}
......
......@@ -228,7 +228,7 @@ Sqlite3DataSrc::findRecords(const Name& name, const RRType& rdtype,
RRsetList& target, const Name* zonename,
const Mode mode, uint32_t& flags) const
{
logger.debug(DBG_TRACE_DETAILED, DATASRC_SQLITE_FINDREC).arg(name).
LOG_DEBUG(logger, DBG_TRACE_DETAILED, DATASRC_SQLITE_FINDREC).arg(name).
arg(rdtype);
flags = 0;
int zone_id = (zonename == NULL) ? findClosest(name, NULL) :
......@@ -348,17 +348,17 @@ Sqlite3DataSrc::findClosest(const Name& name, unsigned int* position) const {
void
Sqlite3DataSrc::findClosestEnclosure(DataSrcMatch& match) const {
logger.debug(DBG_TRACE_DATA, DATASRC_SQLITE_ENCLOSURE).
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_SQLITE_ENCLOSURE).
arg(match.getName());
if (match.getClass() != getClass() && match.getClass() != RRClass::ANY()) {
logger.error(DATASRC_SQLITE_ENCLOSURE_BAD_CLASS).arg(getClass()).
LOG_ERROR(logger, DATASRC_SQLITE_ENCLOSURE_BAD_CLASS).arg(getClass()).
arg(match.getClass());
return;
}
unsigned int position;
if (findClosest(match.getName(), &position) == -1) {
logger.debug(DBG_TRACE_DATA, DATASRC_SQLITE_ENCLOSURE_NOTFOUND);
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_SQLITE_ENCLOSURE_NOTFOUND);
return;
}
......@@ -370,11 +370,11 @@ Sqlite3DataSrc::findPreviousName(const Name& qname,
Name& target,
const Name* zonename) const
{
logger.debug(DBG_TRACE_DATA, DATASRC_SQLITE_PREVIOUS).arg(qname);
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_SQLITE_PREVIOUS).arg(qname);
const int zone_id = (zonename == NULL) ?
findClosest(qname, NULL) : findClosest(*zonename, NULL);
if (zone_id < 0) {
logger.error(DATASRC_SQLITE_PREVIOUS_NO_ZONE).arg(qname.toText());
LOG_ERROR(logger, DATASRC_SQLITE_PREVIOUS_NO_ZONE).arg(qname.toText());
return (ERROR);
}
......@@ -412,11 +412,11 @@ Sqlite3DataSrc::findCoveringNSEC3(const Name& zonename,
string& hashstr,
RRsetList& target) const
{
logger.debug(DBG_TRACE_DATA, DATASRC_SQLITE_FIND_NSEC3).
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_SQLITE_FIND_NSEC3).
arg(zonename).arg(hashstr);
const int zone_id = findClosest(zonename, NULL);
if (zone_id < 0) {
logger.error(DATASRC_SQLITE_FIND_NSEC3_NO_ZONE).arg(zonename);
LOG_ERROR(logger, DATASRC_SQLITE_FIND_NSEC3_NO_ZONE).arg(zonename);
return (ERROR);
}
......@@ -497,10 +497,10 @@ Sqlite3DataSrc::findRRset(const Name& qname,
uint32_t& flags,
const Name* zonename) const
{
logger.debug(DBG_TRACE_DATA, DATASRC_SQLITE_FIND).arg(qname).
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_SQLITE_FIND).arg(qname).
arg(qtype);
if (qclass != getClass() && qclass != RRClass::ANY()) {
logger.error(DATASRC_SQLITE_FIND_BAD_CLASS).arg(getClass()).
LOG_ERROR(logger, DATASRC_SQLITE_FIND_BAD_CLASS).arg(getClass()).
arg(qclass);
return (ERROR);
}
......@@ -516,10 +516,10 @@ Sqlite3DataSrc::findExactRRset(const Name& qname,
uint32_t& flags,
const Name* zonename) const
{
logger.debug(DBG_TRACE_DATA, DATASRC_SQLITE_FINDEXACT).arg(qname).
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_SQLITE_FINDEXACT).arg(qname).
arg(qtype);