Browse Source

[trac745] Take account of changed calling sequence and message file format

Stephen Morris 14 years ago
parent
commit
33cd7d9232

+ 2 - 2
src/lib/nsas/nameserver_address_store.cc

@@ -87,7 +87,7 @@ NameserverAddressStore::lookup(const string& zone, const RRClass& class_code,
     boost::shared_ptr<AddressRequestCallback> callback, AddressFamily family,
     const GlueHints& glue_hints)
 {
-    nsas_logger.debug(NSAS_DBG_TRACE, NSAS_LOOKUPZONE, zone.c_str());
+    LOG_DEBUG(nsas_logger, NSAS_DBG_TRACE, NSAS_LOOKUPZONE).arg(zone);
 
     pair<bool, boost::shared_ptr<ZoneEntry> > zone_obj(
         zone_hash_->getOrAdd(HashKey(zone, class_code),
@@ -108,7 +108,7 @@ NameserverAddressStore::cancel(const string& zone,
     const boost::shared_ptr<AddressRequestCallback>& callback,
     AddressFamily family)
 {
-    nsas_logger.debug(NSAS_DBG_TRACE, NSAS_LOOKUPCANCEL, zone.c_str());
+    LOG_DEBUG(nsas_logger, NSAS_DBG_TRACE, NSAS_LOOKUPCANCEL).arg(zone);
 
     boost::shared_ptr<ZoneEntry> entry(zone_hash_->get(HashKey(zone,
                                                                class_code)));

+ 18 - 15
src/lib/nsas/nameserver_entry.cc

@@ -179,9 +179,10 @@ NameserverEntry::updateAddressRTTAtIndex(uint32_t rtt, size_t index,
         new_rtt = 1;
     }
     addresses_[family][index].setRTT(new_rtt);
-    nsas_logger.debug(NSAS_DBG_RTT, NSAS_SETRTT,
-                      addresses_[family][index].getAddress().toText().c_str(),
-                      old_rtt, new_rtt);
+    LOG_DEBUG(nsas_logger, NSAS_DBG_RTT, NSAS_SETRTT)
+              .arg(addresses_[family][index].getAddress().toText())
+              .arg(old_rtt)
+              .arg(new_rtt);
 }
 
 void
@@ -234,7 +235,7 @@ class NameserverEntry::ResolverCallback :
             if (!response_message ||
                 response_message->getRcode() != isc::dns::Rcode::NOERROR() ||
                 response_message->getRRCount(isc::dns::Message::SECTION_ANSWER) == 0) {
-                nsas_logger.error(NSAS_INVRESPSTR, entry_->getName().c_str());
+                LOG_ERROR(nsas_logger, NSAS_INVRESPSTR).arg(entry_->getName());
                 failureInternal(lock);
                 return;
             }
@@ -249,11 +250,12 @@ class NameserverEntry::ResolverCallback :
                 response->getClass() != RRClass(entry_->getClass()))
             {
                 // Invalid response type or class
-                nsas_logger.error(NSAS_INVRESPTC, entry_->getName().c_str(),
-                                  type_.toText().c_str(),
-                                  RRClass(entry_->getClass()).toText().c_str(),
-                                  response->getType().toText().c_str(),
-                                  response->getClass().toText().c_str());
+                LOG_ERROR(nsas_logger, NSAS_INVRESPTC)
+                          .arg(entry_->getName())
+                          .arg(type_.toText())
+                          .arg(RRClass(entry_->getClass()).toText())
+                          .arg(response->getType().toText())
+                          .arg(response->getClass().toText());
 
                 failureInternal(lock);
                 return;
@@ -277,8 +279,9 @@ class NameserverEntry::ResolverCallback :
                 // If we found it, use it. If not, create a new one.
                 entries.push_back(found ? *found : AddressEntry(
                                                    IOAddress(address), 1));
-                nsas_logger.debug(NSAS_DBG_RESULTS, NSAS_NSLKUPSUCC,
-                                  address.c_str(), entry_->getName().c_str());
+                LOG_DEBUG(nsas_logger, NSAS_DBG_RESULTS, NSAS_NSLKUPSUCC)
+                          .arg(address)
+                          .arg(entry_->getName());
             }
 
             // We no longer need the previous set of addresses, we have
@@ -323,9 +326,9 @@ class NameserverEntry::ResolverCallback :
          * So mark the current address family as unreachable.
          */
         virtual void failure() {
-            nsas_logger.debug(NSAS_DBG_RESULTS, NSAS_NSLKUPFAIL,
-                              type_.toText().c_str(),
-                              entry_->getName().c_str());
+            LOG_DEBUG(nsas_logger, NSAS_DBG_RESULTS, NSAS_NSLKUPFAIL)
+                      .arg(type_.toText())
+                      .arg(entry_->getName());
             Lock lock(entry_->mutex_);
             failureInternal(lock);
         }
@@ -439,7 +442,7 @@ NameserverEntry::askIP(isc::resolve::ResolverInterface* resolver,
         // We are unlocked here, as the callback from that might want to lock
         lock.unlock();
 
-        nsas_logger.debug(NSAS_DBG_TRACE, NSAS_NSADDR, getName().c_str());
+        LOG_DEBUG(nsas_logger, NSAS_DBG_TRACE, NSAS_NSADDR).arg(getName());
         askIP(resolver, RRType::A(), V4_ONLY);
         askIP(resolver, RRType::AAAA(), V6_ONLY);
         // Make sure we end the routine when we are not locked

+ 1 - 1
src/lib/nsas/nsas_log.h

@@ -15,7 +15,7 @@
 #ifndef __NSAS_LOG__H
 #define __NSAS_LOG__H
 
-#include <log/logger.h>
+#include <log/macros.h>
 #include "nsasdef.h"
 
 namespace isc {

+ 44 - 44
src/lib/nsas/nsasdef.mes

@@ -15,47 +15,47 @@
 $PREFIX NSAS_
 $NAMESPACE isc::nsas
 
-INVRESPSTR      queried for %s but got invalid response
-+ This message indicates an internal error in the nameserver address store
-+ component (NSAS) of the resolver.  The NSAS made a query for a RR for the
-+ specified nameserver but received an invalid response.  Either the success
-+ function was called without a DNS message or the message was invalid on some
-+ way. (In the latter case, the error should have been picked up elsewhere in
-+ the processing logic, hence the raising of the error here.)
-
-INVRESPTC       queried for %s RR of type/class %s/%s, received response %s/%s
-+ This message indicates an internal error in the nameserver address store
-+ component (NSAS) of the resolver.  The NSAS made a query for the given RR
-+ type and class, but instead received an answer with the given type and class.
-
-LOOKUPCANCEL    lookup for zone %s has been cancelled
-+ A debug message, this is output when a NSAS (nameserver address store -
-+ part of the resolver) lookup for a zone has been cancelled.
-
-LOOKUPZONE      searching NSAS for nameservers for zone %s
-+ A debug message, this is output when a call is made to the nameserver address
-+ store (part of the resolver) to obtain the nameservers for the specified zone.
-
-NSADDR          asking resolver to obtain A and AAAA records for %s
-+ A debug message, the NSAS (nameserver address store - part of the resolver) is
-+ making a callback into the resolver to retrieve the address records for the
-+ specified nameserver.
-
-NSLKUPFAIL      failed to lookup any %s for %s
-+ A debug message, the NSAS (nameserver address store - part of the resolver)
-+ has been unable to retrieve the specified resource record for the specified
-+ nameserver.  This is not necessarily a problem - the nameserver may be
-+ unreachable, in which case the NSAS will try other nameservers in the zone.
-
-NSLKUPSUCC      found address %s for %s
-+ A debug message, the NSAS (nameserver address store - part of the resolver)
-+ has retrieved the given address for the specified nameserver through an
-+ external query.
-
-SETRTT          reporting RTT for %s as %d; new value is now %d
-+ A NSAS (nameserver address store - part of the resolver) debug message
-+ reporting the round-trip time (RTT) for a query made to the specified
-+ nameserver.  The RTT has been updated using the value given and the new RTT is
-+ displayed.  (The RTT is subject to a calculation that damps out sudden
-+ changes.  As a result, the new RTT is not necessarily equal to the RTT
-+ reported.)
+% INVRESPSTR      queried for %1 but got invalid response
+This message indicates an internal error in the nameserver address store
+component (NSAS) of the resolver.  The NSAS made a query for a RR for the
+specified nameserver but received an invalid response.  Either the success
+function was called without a DNS message or the message was invalid on some
+way. (In the latter case, the error should have been picked up elsewhere in
+the processing logic, hence the raising of the error here.)
+
+% INVRESPTC       queried for %1 RR of type/class %2/%3, received response %4/%5
+This message indicates an internal error in the nameserver address store
+component (NSAS) of the resolver.  The NSAS made a query for the given RR
+type and class, but instead received an answer with the given type and class.
+
+% LOOKUPCANCEL    lookup for zone %1 has been cancelled
+A debug message, this is output when a NSAS (nameserver address store -
+part of the resolver) lookup for a zone has been cancelled.
+
+% LOOKUPZONE      searching NSAS for nameservers for zone %1
+A debug message, this is output when a call is made to the nameserver address
+store (part of the resolver) to obtain the nameservers for the specified zone.
+
+% NSADDR          asking resolver to obtain A and AAAA records for %1
+A debug message, the NSAS (nameserver address store - part of the resolver) is
+making a callback into the resolver to retrieve the address records for the
+specified nameserver.
+
+% NSLKUPFAIL      failed to lookup any %1 for %2
+A debug message, the NSAS (nameserver address store - part of the resolver)
+has been unable to retrieve the specified resource record for the specified
+nameserver.  This is not necessarily a problem - the nameserver may be
+unreachable, in which case the NSAS will try other nameservers in the zone.
+
+% NSLKUPSUCC      found address %1 for %2
+A debug message, the NSAS (nameserver address store - part of the resolver)
+has retrieved the given address for the specified nameserver through an
+external query.
+
+% SETRTT          reporting RTT for %1 as %2; new value is now %3
+A NSAS (nameserver address store - part of the resolver) debug message
+reporting the round-trip time (RTT) for a query made to the specified
+nameserver.  The RTT has been updated using the value given and the new RTT is
+displayed.  (The RTT is subject to a calculation that damps out sudden
+changes.  As a result, the new RTT is not necessarily equal to the RTT
+reported.)