diff --git a/modules/ripple_basics/diagnostic/ripple_Log.h b/modules/ripple_basics/diagnostic/ripple_Log.h index 6af5663833..ec8032e478 100644 --- a/modules/ripple_basics/diagnostic/ripple_Log.h +++ b/modules/ripple_basics/diagnostic/ripple_Log.h @@ -47,14 +47,14 @@ private: public: template - inline static LogPartition const& get () + static LogPartition const& get () { static LogPartition logPartition (getFileName ()); return logPartition; } }; -#define SETUP_LOG(k) template <> char const* LogPartition::getFileName () { return __FILE__; } +#define SETUP_LOG(k) template <> inline char const* LogPartition::getFileName () { return __FILE__; } //------------------------------------------------------------------------------ diff --git a/src/cpp/ripple/Application.cpp b/src/cpp/ripple/Application.cpp index 52ab879409..917be3b54a 100644 --- a/src/cpp/ripple/Application.cpp +++ b/src/cpp/ripple/Application.cpp @@ -25,8 +25,7 @@ SETUP_LOG (Application) -// VFALCO: TODO, fix this, it might have broken with the Log changes -LogPartition TaggedCachePartition("TaggedCache"); +// VFALCO: TODO, fix/clean this, it might have broken with the Log changes LogPartition AutoSocketPartition("AutoSocket"); Application* theApp = NULL; diff --git a/src/cpp/ripple/TaggedCache.h b/src/cpp/ripple/TaggedCache.h index d7af5544af..e9b39994d3 100644 --- a/src/cpp/ripple/TaggedCache.h +++ b/src/cpp/ripple/TaggedCache.h @@ -9,7 +9,6 @@ #include #include -extern LogPartition TaggedCachePartition; extern int upTime(); // This class implements a cache and a map. The cache keeps objects alive @@ -23,6 +22,10 @@ extern int upTime(); // CAUTION: Callers must not modify data objects that are stored in the cache // unless they hold their own lock over all cache operations. +struct TaggedCacheLog { }; + +SETUP_LOG (TaggedCacheLog) + template class TaggedCache { public: @@ -105,7 +108,7 @@ template void TaggedCache::setTa mTargetSize = s; if (s > 0) mCache.rehash(static_cast((s + (s >> 2)) / mCache.max_load_factor() + 1)); - Log(lsDEBUG, TaggedCachePartition) << mName << " target size set to " << s; + WriteLog (lsDEBUG, TaggedCacheLog) << mName << " target size set to " << s; } template int TaggedCache::getTargetAge() const @@ -118,7 +121,7 @@ template void TaggedCache::setTa { boost::recursive_mutex::scoped_lock sl(mLock); mTargetAge = s; - Log(lsDEBUG, TaggedCachePartition) << mName << " target age set to " << s; + WriteLog (lsDEBUG, TaggedCacheLog) << mName << " target age set to " << s; } template int TaggedCache::getCacheSize() @@ -166,7 +169,7 @@ template void TaggedCache::sweep target = mLastSweep - (mTargetAge * mTargetSize / mCache.size()); if (target > (mLastSweep - 2)) target = mLastSweep - 2; - Log(lsINFO, TaggedCachePartition) << mName << " is growing fast " << + WriteLog (lsINFO, TaggedCacheLog) << mName << " is growing fast " << mCache.size() << " of " << mTargetSize << " aging at " << (mLastSweep - target) << " of " << mTargetAge; } @@ -205,8 +208,8 @@ template void TaggedCache::sweep } assert(cc == mCacheCount); - if (TaggedCachePartition.doLog(lsTRACE) && (mapRemovals || cacheRemovals)) - Log(lsTRACE, TaggedCachePartition) << mName << ": cache = " << mCache.size() << "-" << cacheRemovals << + if (ShouldLog (lsTRACE, TaggedCacheLog) && (mapRemovals || cacheRemovals)) + WriteLog (lsTRACE, TaggedCacheLog) << mName << ": cache = " << mCache.size() << "-" << cacheRemovals << ", map-=" << mapRemovals; }