Browse Source

[trac744] Logging enhancements

Some texts of messages and parameters.
Michal 'vorner' Vaner 14 years ago
parent
commit
80c0a2c3ee
2 changed files with 15 additions and 17 deletions
  1. 5 6
      src/lib/datasrc/cache.cc
  2. 10 11
      src/lib/datasrc/messagedef.mes

+ 5 - 6
src/lib/datasrc/cache.cc

@@ -311,26 +311,24 @@ HotCache::retrieve(const Name& n, const RRClass& c, const RRType& t,
         return (false);
     }
 
-    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));
     if (iter == impl_->map_.end()) {
-        logger.debug(DBG_TRACE_DATA, DATASRC_CACHE_NOT_FOUND);
+        logger.debug(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);
+        logger.debug(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);
+    logger.debug(DBG_TRACE_DATA, DATASRC_CACHE_EXPIRED).arg(n);
     impl_->remove(node);
     return (false);
 }
@@ -344,7 +342,8 @@ HotCache::setSlots(const int slots) {
         return;
     }
 
-    logger.info(DATASRC_CACHE_SLOTS).arg(slots);
+    logger.info(DATASRC_CACHE_SLOTS).arg(slots).arg(max(0, impl_->count_ -
+                                                        slots));
 
     while (impl_->slots_ != 0 && impl_->count_ > impl_->slots_) {
         impl_->remove(impl_->lru_.back());

+ 10 - 11
src/lib/datasrc/messagedef.mes

@@ -44,20 +44,19 @@ CACHE_LOOKUP looking up '%1' in the cache
 + Debug information. We are trying to look up an item in the hotspot cache.
 + Further progress and result will follow.
 
-CACHE_NOT_FOUND the item was not found
-+ Debug information. The item we tried to look in the last CACHE_LOOKUP was
-+ not found in the hotspot cache.
+CACHE_NOT_FOUND the item '%1' was not found
++ Debug information. We tried to look up an item in the hotspot cache, but
++ it is not there.
 
-CACHE_FOUND the item was found
-+ Debug information. The last CACHE_LOOKUP was successful, eg. we have found
-+ the requested item in the hotspot cache.
+CACHE_FOUND the item '%1' was found
++ Debug information. We successfully looked up an item in the hotspot cache.
 
-CACHE_EXPIRED the item is expired
-+ Debug information. The item requested in the last CACHE_LOOKUP was in the
-+ hotspot cache, but it was old. We're going to remove it and report we don't
-+ have it (the external result will be the same as with CACHE_NOT_FOUND).
+CACHE_EXPIRED the item '%1' is expired
++ Debug information. We tried to find an item in the hotspot cache and in fact
++ we did, but it was too old. So we pretend we didn't find it at all (the
++ external effect is the same as CACHE_NOT_FOUND).
 
-CACHE_SLOTS setting the cache size to '%1'
+CACHE_SLOTS setting the cache size to '%1', dropping '%2' items
 + The maximum allowed number of items of the hotspot cache is set to the given
 + number. If there are too many, we're going to drop them right now. The size
 + of 0 means no limit.