[asterisk-scf-commits] asterisk-scf/integration/logger.git branch "ref-counting" created.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Fri Dec 10 11:03:27 CST 2010
branch "ref-counting" has been created
at 9f04ff8250a49f6185a58c30f681427f26b617ff (commit)
- Log -----------------------------------------------------------------
commit 9f04ff8250a49f6185a58c30f681427f26b617ff
Author: Ken Hunt <ken.hunt at digium.com>
Date: Tue Dec 7 17:17:36 2010 -0600
Added ref to boost date_time. On Windows boost::thread has a dependency
on boost::date_time.
diff --git a/client/src/CMakeLists.txt b/client/src/CMakeLists.txt
index ba73028..cdf9c90 100644
--- a/client/src/CMakeLists.txt
+++ b/client/src/CMakeLists.txt
@@ -24,7 +24,7 @@ asterisk_scf_component_add_slice(logging-client LoggerIf)
asterisk_scf_component_add_slice(logging-client ServiceLocatorIf)
asterisk_scf_component_add_slice(logging-client ServiceLocatorEventsIf)
-asterisk_scf_component_add_boost_libraries(logging-client thread)
+asterisk_scf_component_add_boost_libraries(logging-client thread date_time)
asterisk_scf_add_ice_libraries(IceStorm)
asterisk_scf_component_build_library(logging-client)
commit 19947c9ca431f79b03cf07aa3fa8a4a7b3cfe53f
Author: David M. Lee <dlee at digium.com>
Date: Tue Dec 7 17:11:54 2010 -0600
Fixed linker error on Windows.
ICEBOX_EXPORTING an inline function is actually a bad idea. This causes
the Windows compiler to create an instantiation of that function, even if
it's unused. Since isEnabledFor called another function, this led to
linker errors if you #include "logger.h" but didn't add the logger-client
library.
diff --git a/client/src/logger.h b/client/src/logger.h
index 90e79c5..88e375a 100644
--- a/client/src/logger.h
+++ b/client/src/logger.h
@@ -159,7 +159,7 @@ public:
* @param level Level to check.
* @return true if enabled for given level.
*/
- ASTERISK_SCF_ICEBOX_EXPORT bool isEnabledFor(Level level) const
+ bool isEnabledFor(Level level) const
{
return level >= getEffectiveLevel();
}
commit 7440f3117505886b277b1f4b875d621eb4ff923c
Author: Ken Hunt <ken.hunt at digium.com>
Date: Tue Dec 7 16:07:51 2010 -0600
Added boost reference for shared_ptr usage.
diff --git a/server/src/CMakeLists.txt b/server/src/CMakeLists.txt
index 1cf9d8f..63e6c1e 100644
--- a/server/src/CMakeLists.txt
+++ b/server/src/CMakeLists.txt
@@ -25,6 +25,7 @@ asterisk_scf_component_add_file(logging-service OstreamChainedLogOut.h)
asterisk_scf_component_add_file(logging-service LoggingServer.h)
asterisk_scf_add_ice_libraries(IceStorm)
+asterisk_scf_component_add_boost_libraries(logging-service core)
asterisk_scf_component_build_icebox(logging-service)
commit b65f114294c2d79c7c8b455df77f7ad40c70e213
Author: Ken Hunt <ken.hunt at digium.com>
Date: Fri Dec 3 13:27:59 2010 -0600
Manage boost link options in CMake.
diff --git a/client/src/CMakeLists.txt b/client/src/CMakeLists.txt
index 74675bd..ba73028 100644
--- a/client/src/CMakeLists.txt
+++ b/client/src/CMakeLists.txt
@@ -24,7 +24,7 @@ asterisk_scf_component_add_slice(logging-client LoggerIf)
asterisk_scf_component_add_slice(logging-client ServiceLocatorIf)
asterisk_scf_component_add_slice(logging-client ServiceLocatorEventsIf)
-asterisk_scf_add_boost_libraries(thread)
+asterisk_scf_component_add_boost_libraries(logging-client thread)
asterisk_scf_add_ice_libraries(IceStorm)
asterisk_scf_component_build_library(logging-client)
diff --git a/client/test/CMakeLists.txt b/client/test/CMakeLists.txt
index fc1e634..e52affb 100644
--- a/client/test/CMakeLists.txt
+++ b/client/test/CMakeLists.txt
@@ -32,11 +32,7 @@ asterisk_scf_component_init(scf-log CXX)
asterisk_scf_component_add_file(scf-log scf-log.cpp)
asterisk_scf_component_add_slice(scf-log LoggerIf)
-# For reasons unknown, adding this library causes duplicate symbol errors
-# on Windows. But without it, Mac and Linux fail to compile
-if(NOT WIN32)
- asterisk_scf_component_add_boost_libraries(scf-log program_options)
-endif()
+asterisk_scf_component_add_boost_libraries(scf-log program_options)
asterisk_scf_component_build_standalone(scf-log)
target_link_libraries(scf-log logging-client)
diff --git a/client/test/client-test.cpp b/client/test/client-test.cpp
index 611848a..5503c6c 100644
--- a/client/test/client-test.cpp
+++ b/client/test/client-test.cpp
@@ -14,6 +14,5 @@
* at the top of the source tree.
*/
-#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE Logger-client
#include <boost/test/unit_test.hpp>
diff --git a/server/test/server-test.cpp b/server/test/server-test.cpp
index cc7b3bc..a1fbcec 100644
--- a/server/test/server-test.cpp
+++ b/server/test/server-test.cpp
@@ -14,6 +14,5 @@
* at the top of the source tree.
*/
-#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE Logger-server
#include <boost/test/unit_test.hpp>
commit c2c52a84376b44740f9be2579a88160838303525
Author: David M. Lee <dlee at digium.com>
Date: Thu Dec 2 15:50:34 2010 -0600
Pass shared_ptr by reference.
See CR-ASTSCF-4.
diff --git a/server/src/FileChainedLogOut.h b/server/src/FileChainedLogOut.h
index 89958c6..abd5c3e 100644
--- a/server/src/FileChainedLogOut.h
+++ b/server/src/FileChainedLogOut.h
@@ -36,7 +36,9 @@ public:
ChainedLogOut(), mLogFile(logFile)
{
}
- FileChainedLogOut(const std::string& logFile, boost::shared_ptr<ChainedLogOut> next) :
+ FileChainedLogOut(const std::string& logFile,
+ const boost::shared_ptr<ChainedLogOut>& next)
+ :
ChainedLogOut(next), mLogFile(logFile)
{
}
commit 4a538313aa8c9a4c08d6d160397a9005097ca2ab
Author: David M. Lee <dlee at digium.com>
Date: Wed Dec 1 16:20:53 2010 -0600
Put comment back with the code it describes.
diff --git a/client/src/Logger.cpp b/client/src/Logger.cpp
index 84291ff..d410834 100644
--- a/client/src/Logger.cpp
+++ b/client/src/Logger.cpp
@@ -153,8 +153,9 @@ Level Logger::getEffectiveLevel() const
Logger& Logger::getChild(const std::string& childName)
{
- // ref to ptr allows us to update the map in-place
IceUtil::Mutex::Lock childLock(mChildrenMutex);
+
+ // ref to ptr allows us to update the map in-place
boost::shared_ptr<Logger>& child = mChildren[childName];
if (child == 0)
{
commit 7796f58cbd4bc1d5f0e32993afa54df6f2502ec0
Author: David M. Lee <dlee at digium.com>
Date: Wed Dec 1 15:05:34 2010 -0600
Translated comments from gibberish to English.
See CR-ASTSCF-4.
diff --git a/server/src/LoggingServer.cpp b/server/src/LoggingServer.cpp
index db2fd77..9ffd9eb 100644
--- a/server/src/LoggingServer.cpp
+++ b/server/src/LoggingServer.cpp
@@ -43,11 +43,12 @@ Level LoggingServerI::getEffectiveLevel(const std::string& name) const
// thread safety
IceUtil::Mutex::Lock sourcesLock(mSourcesMutex);
- // this is they the map is reverse sorted. find the first entry where
- // the source key is a substring of the source we're looking for, where
- // the substring
- for (Sources::const_iterator i = mSources.lower_bound(name); i
- != mSources.end(); ++i)
+ // the map is reverse sorted. we're looking for the first entry where
+ // the source key is a subpath of name. that would be the most specified
+ // configuration that matches the name we're looking for.
+ for (Sources::const_iterator i = mSources.lower_bound(name);
+ i != mSources.end();
+ ++i)
{
if (isSubpathOf(name, i->first))
{
diff --git a/server/src/LoggingServer.h b/server/src/LoggingServer.h
index 72c1525..2e81a12 100644
--- a/server/src/LoggingServer.h
+++ b/server/src/LoggingServer.h
@@ -86,7 +86,7 @@ private:
Sources;
/**
- * Returns true is subpath is a subpath of path.
+ * Returns true if paramater subpath is actually a subpath of path.
*
* @param path Full path to search.
* @param subpath Subpath to look for.
commit 09dc7e3800b6002ce7b00372e7292f3490805ccb
Author: David M. Lee <dlee at digium.com>
Date: Wed Dec 1 14:52:15 2010 -0600
Replaced some manual memory management with shared_ptr.
See CR-ASTSCF-4.
diff --git a/client/src/Logger.cpp b/client/src/Logger.cpp
index da48ffd..84291ff 100644
--- a/client/src/Logger.cpp
+++ b/client/src/Logger.cpp
@@ -78,13 +78,6 @@ Logger::Logger(const Logger& parent, const std::string& name) :
Logger::~Logger()
{
IceUtil::Mutex::Lock childLock(mChildrenMutex);
- for (std::map<std::string, Logger *>::iterator i = mChildren.begin();
- i != mChildren.end();
- ++i)
- {
- delete i->second;
- i->second = 0;
- }
}
CondStream Logger::operator()(Level level) const
@@ -124,8 +117,9 @@ void Logger::setOutput(LogOut& out)
{
this->mOut = &out;
IceUtil::Mutex::Lock childLock(mChildrenMutex);
- for (std::map<std::string, Logger *>::const_iterator i = mChildren.begin(); i
- != mChildren.end(); ++i)
+ for (Children::const_iterator i = mChildren.begin();
+ i != mChildren.end();
+ ++i)
{
i->second->setOutput(out);
}
@@ -161,21 +155,21 @@ Logger& Logger::getChild(const std::string& childName)
{
// ref to ptr allows us to update the map in-place
IceUtil::Mutex::Lock childLock(mChildrenMutex);
- Logger *&child = mChildren[childName];
+ boost::shared_ptr<Logger>& child = mChildren[childName];
if (child == 0)
{
std::string fullName = getName().empty() ? childName : getName() + "."
+ childName;
- child = new Logger(*this, fullName);
+ child.reset(new Logger(*this, fullName));
}
return *child;
}
-std::vector<Logger const *> Logger::getChildren() const
+std::vector<boost::shared_ptr<const Logger> > Logger::getChildren() const
{
- std::vector<Logger const *> r;
+ std::vector<boost::shared_ptr<const Logger> > r;
IceUtil::Mutex::Lock childLock(mChildrenMutex);
- for (std::map<std::string, Logger *>::const_iterator i = mChildren.begin();
+ for (Children::const_iterator i = mChildren.begin();
i != mChildren.end();
++i)
{
diff --git a/client/src/LoggerFactory.cpp b/client/src/LoggerFactory.cpp
index daba661..81e349b 100644
--- a/client/src/LoggerFactory.cpp
+++ b/client/src/LoggerFactory.cpp
@@ -86,8 +86,8 @@ void LoggerFactory::accumulateLoggerNames(const Logger& logger,
{
out.push_back(logger.getName());
// recurse through the children
- const std::vector<const Logger*>& children = logger.getChildren();
- for (std::vector<const Logger*>::const_iterator i = children.begin(); i
+ const std::vector<boost::shared_ptr<const Logger> >& children = logger.getChildren();
+ for (std::vector<boost::shared_ptr<const Logger> >::const_iterator i = children.begin(); i
!= children.end(); ++i)
{
accumulateLoggerNames(**i, out);
diff --git a/client/src/logger.h b/client/src/logger.h
index bf99202..90e79c5 100644
--- a/client/src/logger.h
+++ b/client/src/logger.h
@@ -193,7 +193,7 @@ public:
}
ASTERISK_SCF_ICEBOX_EXPORT Logger& getChild(const std::string& childName);
- ASTERISK_SCF_ICEBOX_EXPORT std::vector<Logger const *> getChildren() const;
+ ASTERISK_SCF_ICEBOX_EXPORT std::vector<boost::shared_ptr<const Logger> > getChildren() const;
ASTERISK_SCF_ICEBOX_EXPORT const std::string& getName() const
{
@@ -238,10 +238,11 @@ private:
* our parent.
*/
Logger const * const mParent;
+ typedef std::map<std::string, boost::shared_ptr<Logger> > Children;
/**
* Map of children. The key is the next final node in that child's name.
*/
- std::map<std::string, Logger *> mChildren;
+ Children mChildren;
/**
* Name of this logger, in dotted-notation.
commit c9c26d01efe6dce1518be4ff01969bfc9bdd214a
Author: David M. Lee <dlee at digium.com>
Date: Wed Dec 1 14:27:09 2010 -0600
Professionalize an error message.
See CR-ASTSCF-4.
diff --git a/client/src/IceLogger.cpp b/client/src/IceLogger.cpp
index 928cbd7..92cb0a4 100644
--- a/client/src/IceLogger.cpp
+++ b/client/src/IceLogger.cpp
@@ -51,7 +51,8 @@ void IceLogger::logs(const std::string& name, Level logLevel,
if (!hasPrintedNoServerNotice) {
hasPrintedNoServerNotice = true;
std::clog <<
- "!!! unable to log to server. logging to stderr instead.\n";
+ "!!! Unable to log to server. Please check configuration and server status.\n"
+ "!!! Logging to stderr instead.\n";
}
std::clog << name << ":" << logLevel << ":" << message << '\n';
}
commit cae06bbf5d29ce2f65761eb1092967d6a85b69a4
Author: David M. Lee <dlee at digium.com>
Date: Tue Nov 30 17:20:03 2010 -0600
Foo & -> Foo&
Squish & next to referenced type, to be consistent with the rest of the
code.
See CR-ASTSCF-4.
diff --git a/client/src/IceConfigurator.cpp b/client/src/IceConfigurator.cpp
index 83740ef..508ff04 100644
--- a/client/src/IceConfigurator.cpp
+++ b/client/src/IceConfigurator.cpp
@@ -101,7 +101,7 @@ void IceConfigurator::configured(const Configuration& logConfiguration)
}
IceConfiguratorPtr AsteriskSCF::System::Logging::createIceConfigurator(
- const Ice::ObjectAdapterPtr& adapter, LoggerFactory &factory)
+ const Ice::ObjectAdapterPtr& adapter, LoggerFactory& factory)
{
Ice::CommunicatorPtr communicator = adapter->getCommunicator();
diff --git a/client/src/IceConfigurator.h b/client/src/IceConfigurator.h
index 2d31bda..5a5d032 100644
--- a/client/src/IceConfigurator.h
+++ b/client/src/IceConfigurator.h
@@ -32,7 +32,7 @@ namespace Logging
class IceConfigurator : public ServerConfigurationListener
{
public:
- IceConfigurator(LoggerFactory &factory) :
+ IceConfigurator(LoggerFactory& factory) :
mFactory(factory)
{
}
@@ -40,13 +40,13 @@ public:
ASTERISK_SCF_ICEBOX_EXPORT void configured(const Configuration& logConfiguration, const Ice::Current&);
ASTERISK_SCF_ICEBOX_EXPORT void configured(const Configuration& logConfiguration);
private:
- LoggerFactory &mFactory;
+ LoggerFactory& mFactory;
};
typedef IceUtil::Handle<IceConfigurator> IceConfiguratorPtr;
ASTERISK_SCF_ICEBOX_EXPORT IceConfiguratorPtr createIceConfigurator(const Ice::ObjectAdapterPtr& adapter,
- LoggerFactory &factory);
+ LoggerFactory& factory);
} // Logging
} // System
diff --git a/client/src/IceLogger.cpp b/client/src/IceLogger.cpp
index edf47b0..928cbd7 100644
--- a/client/src/IceLogger.cpp
+++ b/client/src/IceLogger.cpp
@@ -81,7 +81,7 @@ void ConfiguredIceLogger::updateLoggerFromServiceLocator()
}
}
-void ConfiguredIceLogger::locateFinished(const Ice::AsyncResultPtr &r)
+void ConfiguredIceLogger::locateFinished(const Ice::AsyncResultPtr& r)
{
ServiceLocatorPrx locator = ServiceLocatorPrx::uncheckedCast(r->getProxy());
try
diff --git a/client/src/IceLogger.h b/client/src/IceLogger.h
index 977bb4b..87bc42e 100644
--- a/client/src/IceLogger.h
+++ b/client/src/IceLogger.h
@@ -60,7 +60,7 @@ public:
*/
ConfiguredIceLogger(const Core::Discovery::V1::ServiceLocatorPrx& locator);
- LogOut &getLogger() { return mLogger; }
+ LogOut& getLogger() { return mLogger; }
void updateLoggerFromServiceLocator();
@@ -75,7 +75,7 @@ private:
IceLogger mLogger;
Core::Discovery::V1::ServiceLocatorPrx mLocator;
- void locateFinished(const Ice::AsyncResultPtr &r);
+ void locateFinished(const Ice::AsyncResultPtr& r);
};
typedef IceUtil::Handle<ConfiguredIceLogger> ConfiguredIceLoggerPtr;
diff --git a/client/src/Logger.cpp b/client/src/Logger.cpp
index de73b00..da48ffd 100644
--- a/client/src/Logger.cpp
+++ b/client/src/Logger.cpp
@@ -23,7 +23,7 @@ using namespace AsteriskSCF::System::Logging;
const int MESSAGE_SIZE = 120;
-LogBuf::LogBuf(LogOut &out, const std::string& name, Level logLevel) :
+LogBuf::LogBuf(LogOut& out, const std::string& name, Level logLevel) :
mOut(out), nName(name), mLogLevel(logLevel)
{
}
@@ -62,7 +62,7 @@ void LogBuf::sendBuffer()
mOut.logs(nName, mLogLevel, message);
}
-Logger::Logger(const std::string& name, LogOut &out, Level logLevel) :
+Logger::Logger(const std::string& name, LogOut& out, Level logLevel) :
mParent(0), mName(name), mOut(&out), mLogLevel(logLevel), mInheritedLevel(false)
{
}
@@ -120,7 +120,7 @@ void Logger::vlogf(Level level, char const *fmt, va_list ap) const
}
}
-void Logger::setOutput(LogOut &out)
+void Logger::setOutput(LogOut& out)
{
this->mOut = &out;
IceUtil::Mutex::Lock childLock(mChildrenMutex);
@@ -157,7 +157,7 @@ Level Logger::getEffectiveLevel() const
}
}
-Logger &Logger::getChild(const std::string& childName)
+Logger& Logger::getChild(const std::string& childName)
{
// ref to ptr allows us to update the map in-place
IceUtil::Mutex::Lock childLock(mChildrenMutex);
diff --git a/client/src/LoggerFactory.cpp b/client/src/LoggerFactory.cpp
index fe1dd01..daba661 100644
--- a/client/src/LoggerFactory.cpp
+++ b/client/src/LoggerFactory.cpp
@@ -44,18 +44,18 @@ void initLoggerFactory()
}
-LoggerFactory &AsteriskSCF::System::Logging::getLoggerFactory()
+LoggerFactory& AsteriskSCF::System::Logging::getLoggerFactory()
{
boost::call_once(initLoggerFactory, oneFactory);
return *loggerFactory;
}
-LoggerFactory::LoggerFactory(LogOut &out) :
+LoggerFactory::LoggerFactory(LogOut& out) :
mRoot("", out)
{
}
-Logger &LoggerFactory::getLogger(const std::string& name)
+Logger& LoggerFactory::getLogger(const std::string& name)
{
std::vector<std::string> path;
// older versions of boost output a single entry when splitting an empty
@@ -81,20 +81,20 @@ std::vector<std::string> LoggerFactory::getLoggerNames() const
return r;
}
-void LoggerFactory::accumulateLoggerNames(const Logger& logger, std::vector<
- std::string> &out)
+void LoggerFactory::accumulateLoggerNames(const Logger& logger,
+ std::vector<std::string>& out)
{
out.push_back(logger.getName());
// recurse through the children
- std::vector<Logger const *>const & children = logger.getChildren();
- for (std::vector<Logger const *>::const_iterator i = children.begin(); i
+ const std::vector<const Logger*>& children = logger.getChildren();
+ for (std::vector<const Logger*>::const_iterator i = children.begin(); i
!= children.end(); ++i)
{
accumulateLoggerNames(**i, out);
}
}
-void LoggerFactory::setLogOutput(LogOut &out)
+void LoggerFactory::setLogOutput(LogOut& out)
{
mRoot.setOutput(out);
}
diff --git a/client/src/OstreamLogger.cpp b/client/src/OstreamLogger.cpp
index 18869b6..a1f8076 100644
--- a/client/src/OstreamLogger.cpp
+++ b/client/src/OstreamLogger.cpp
@@ -24,7 +24,7 @@ namespace
class OstreamLogger : public LogOut
{
public:
- OstreamLogger(std::ostream &out) :
+ OstreamLogger(std::ostream& out) :
mOut(out)
{
@@ -37,12 +37,12 @@ public:
}
private:
- std::ostream &mOut;
+ std::ostream& mOut;
};
}
-boost::shared_ptr<LogOut> AsteriskSCF::System::Logging::buildOstreamLogger(std::ostream &out)
+boost::shared_ptr<LogOut> AsteriskSCF::System::Logging::buildOstreamLogger(std::ostream& out)
{
return boost::shared_ptr<LogOut>(new OstreamLogger(out));
}
diff --git a/client/src/logger.h b/client/src/logger.h
index ea56655..bf99202 100644
--- a/client/src/logger.h
+++ b/client/src/logger.h
@@ -40,7 +40,7 @@ namespace Logging
class LogBuf : public std::streambuf
{
public:
- ASTERISK_SCF_ICEBOX_EXPORT LogBuf(LogOut &out, const std::string& name, Level logLevel);
+ ASTERISK_SCF_ICEBOX_EXPORT LogBuf(LogOut& out, const std::string& name, Level logLevel);
/**
* Copy ctor.
@@ -55,7 +55,7 @@ protected:
private:
std::stringbuf mBuffer;
- LogOut &mOut;
+ LogOut& mOut;
const std::string nName;
const Level mLogLevel;
@@ -72,7 +72,7 @@ private:
class CondStream
{
public:
- CondStream(LogOut &out, const std::string& name, Level logLevel,
+ CondStream(LogOut& out, const std::string& name, Level logLevel,
bool enabled) :
mBuf(out, name, logLevel), mStream(&mBuf), mEnabled(enabled)
{
@@ -94,12 +94,12 @@ public:
* @return this.
*/
template<typename T>
- CondStream &operator<<(const T& val);
+ CondStream& operator<<(const T& val);
/**
* Output operator for manipulators, such as endl.
*/
- CondStream &operator<<(std::ostream& (*pf)(std::ostream&));
+ CondStream& operator<<(std::ostream& (*pf)(std::ostream&));
private:
/**
@@ -117,7 +117,7 @@ private:
};
template<typename T>
-inline CondStream &CondStream::operator<<(const T& val)
+inline CondStream& CondStream::operator<<(const T& val)
{
if (mEnabled)
{
@@ -126,7 +126,7 @@ inline CondStream &CondStream::operator<<(const T& val)
return *this;
}
-inline CondStream &CondStream::operator<<(std::ostream& (*pf)(std::ostream&))
+inline CondStream& CondStream::operator<<(std::ostream& (*pf)(std::ostream&))
{
if (mEnabled)
{
@@ -144,7 +144,7 @@ public:
/**
* Construct a root Logger.
*/
- ASTERISK_SCF_ICEBOX_EXPORT Logger(const std::string& name, LogOut &out, Level logLevel = Debug);
+ ASTERISK_SCF_ICEBOX_EXPORT Logger(const std::string& name, LogOut& out, Level logLevel = Debug);
/**
* Construct a child Logger.
@@ -192,7 +192,7 @@ public:
return mParent;
}
- ASTERISK_SCF_ICEBOX_EXPORT Logger &getChild(const std::string& childName);
+ ASTERISK_SCF_ICEBOX_EXPORT Logger& getChild(const std::string& childName);
ASTERISK_SCF_ICEBOX_EXPORT std::vector<Logger const *> getChildren() const;
ASTERISK_SCF_ICEBOX_EXPORT const std::string& getName() const
@@ -200,12 +200,12 @@ public:
return mName;
}
- ASTERISK_SCF_ICEBOX_EXPORT LogOut &getOutput() const
+ ASTERISK_SCF_ICEBOX_EXPORT LogOut& getOutput() const
{
return *mOut;
}
- ASTERISK_SCF_ICEBOX_EXPORT void setOutput(LogOut &out);
+ ASTERISK_SCF_ICEBOX_EXPORT void setOutput(LogOut& out);
/**
* Set's the current logLevel. Until unsetLevel() is called, we are no
@@ -267,7 +267,7 @@ private:
class LoggerFactory
{
public:
- ASTERISK_SCF_ICEBOX_EXPORT LoggerFactory(LogOut &out);
+ ASTERISK_SCF_ICEBOX_EXPORT LoggerFactory(LogOut& out);
/**
* Will get the Logger with the given name. If the Logger does not exist,
@@ -277,7 +277,7 @@ public:
* @return Ref to the Logger.
* @thread-safe
*/
- ASTERISK_SCF_ICEBOX_EXPORT Logger &getLogger(const std::string& name);
+ ASTERISK_SCF_ICEBOX_EXPORT Logger& getLogger(const std::string& name);
/**
* Returns a vector of the names of all currently configured Logger's.
@@ -285,20 +285,20 @@ public:
*/
ASTERISK_SCF_ICEBOX_EXPORT std::vector<std::string> getLoggerNames() const;
- ASTERISK_SCF_ICEBOX_EXPORT void setLogOutput(LogOut &out);
+ ASTERISK_SCF_ICEBOX_EXPORT void setLogOutput(LogOut& out);
private:
Logger mRoot;
- static void accumulateLoggerNames(const Logger& logger, std::vector<std::string> &out);
+ static void accumulateLoggerNames(const Logger& logger, std::vector<std::string>& out);
};
-ASTERISK_SCF_ICEBOX_EXPORT boost::shared_ptr<LogOut> buildOstreamLogger(std::ostream &out);
+ASTERISK_SCF_ICEBOX_EXPORT boost::shared_ptr<LogOut> buildOstreamLogger(std::ostream& out);
/**
* Returns the default configured LoggerFactory.
*/
-ASTERISK_SCF_ICEBOX_EXPORT LoggerFactory &getLoggerFactory();
+ASTERISK_SCF_ICEBOX_EXPORT LoggerFactory& getLoggerFactory();
} // Logging
} // System
diff --git a/client/test/IceConfigurator-test.cpp b/client/test/IceConfigurator-test.cpp
index a546fab..90d49e5 100644
--- a/client/test/IceConfigurator-test.cpp
+++ b/client/test/IceConfigurator-test.cpp
@@ -24,7 +24,7 @@ using namespace AsteriskSCF::System::Logging;
namespace
{
-void addConfig(Configuration &cfg, const std::string& name, Level logLevel)
+void addConfig(Configuration& cfg, const std::string& name, Level logLevel)
{
SourceConfiguration sourceConfig = {};
sourceConfig.name = name;
diff --git a/client/test/LoggerFactory-test.cpp b/client/test/LoggerFactory-test.cpp
index 171d262..8d6c3cb 100644
--- a/client/test/LoggerFactory-test.cpp
+++ b/client/test/LoggerFactory-test.cpp
@@ -43,8 +43,8 @@ BOOST_AUTO_TEST_CASE(testInheritence_off)
boost::shared_ptr<LogOut> logOut = buildOstreamLogger(actual);
LoggerFactory uut(*logOut);
- Logger &root = uut.getLogger("");
- Logger &asteriskScf = uut.getLogger("AsteriskSCF");
+ Logger& root = uut.getLogger("");
+ Logger& asteriskScf = uut.getLogger("AsteriskSCF");
root.setLevel(Off);
@@ -58,8 +58,8 @@ BOOST_AUTO_TEST_CASE(testInheritence_on)
boost::shared_ptr<LogOut> logOut = buildOstreamLogger(actual);
LoggerFactory uut(*logOut);
- Logger &root = uut.getLogger("");
- Logger &asteriskScf = uut.getLogger("AsteriskSCF");
+ Logger& root = uut.getLogger("");
+ Logger& asteriskScf = uut.getLogger("AsteriskSCF");
root.setLevel(Debug);
diff --git a/client/test/scf-log.cpp b/client/test/scf-log.cpp
index 5728e10..a80beb4 100644
--- a/client/test/scf-log.cpp
+++ b/client/test/scf-log.cpp
@@ -40,10 +40,10 @@ class ScfLogClientApplication : public Ice::Application
{
public:
int run(int argc, char *argv[]);
- void usage(std::ostream &out);
+ void usage(std::ostream& out);
private:
void setupDefaultProperties();
- void setDefaultProperty(Ice::Properties &properties, const std::string& key,
+ void setDefaultProperty(Ice::Properties& properties, const std::string& key,
const std::string& defaultValue);
};
@@ -112,7 +112,7 @@ int ScfLogClientApplication::run(int argc, char *argv[])
return EXIT_SUCCESS;
}
-void ScfLogClientApplication::usage(std::ostream &out)
+void ScfLogClientApplication::usage(std::ostream& out)
{
out << "Usage: scf-log [-p pri] [-t tag] message...\n";
}
@@ -128,7 +128,7 @@ void ScfLogClientApplication::setupDefaultProperties()
"AsteriskSCFIceStorm/TopicManager:default -p 10000");
}
-void ScfLogClientApplication::setDefaultProperty(Ice::Properties &props,
+void ScfLogClientApplication::setDefaultProperty(Ice::Properties& props,
const std::string& key, const std::string& defaultValue)
{
if (props.getProperty(key).empty())
diff --git a/common/Level.h b/common/Level.h
index 4f31f38..e735bdf 100644
--- a/common/Level.h
+++ b/common/Level.h
@@ -22,7 +22,7 @@ namespace Logging
/**
* Helper to readably output Level.
*/
-inline std::ostream &operator<<(std::ostream &o, Level level)
+inline std::ostream& operator<<(std::ostream& o, Level level)
{
switch (level)
{
diff --git a/server/src/ChainedLogOut.cpp b/server/src/ChainedLogOut.cpp
index 3d53774..66a6e71 100644
--- a/server/src/ChainedLogOut.cpp
+++ b/server/src/ChainedLogOut.cpp
@@ -52,7 +52,7 @@ void ChainedLogOut::logs(const std::string& name, Level logLevel,
}
}
-std::ostream &ChainedLogOut::logs(std::ostream &out, const std::string& name,
+std::ostream& ChainedLogOut::logs(std::ostream& out, const std::string& name,
Level logLevel, const std::string& message)
{
// date level name(1) message
diff --git a/server/src/ChainedLogOut.h b/server/src/ChainedLogOut.h
index 4d34025..931895b 100644
--- a/server/src/ChainedLogOut.h
+++ b/server/src/ChainedLogOut.h
@@ -59,7 +59,7 @@ public:
* @param message Message.
* @return out
*/
- static std::ostream &logs(std::ostream &out, const std::string& name,
+ static std::ostream& logs(std::ostream& out, const std::string& name,
Level logLevel, const std::string& message);
protected:
diff --git a/server/src/LoggingServer.cpp b/server/src/LoggingServer.cpp
index 18b8d40..db2fd77 100644
--- a/server/src/LoggingServer.cpp
+++ b/server/src/LoggingServer.cpp
@@ -75,7 +75,7 @@ void LoggingServerI::setLevel(const std::string& name, Level level)
}
void LoggingServerI::logs(const std::string& name, Level level,
- const std::string &message, const Ice::Current&) const
+ const std::string& message, const Ice::Current&) const
{
if (isEnabledFor(name, level))
{
@@ -139,7 +139,7 @@ bool LoggingServerI::isSubpathOf(const std::string& path,
// <prefix>.logger=level
// <prefix>.logger.<name>=level
-void LoggingServerI::configure(boost::shared_ptr<ChainedLogOut> out,
+void LoggingServerI::configure(const boost::shared_ptr<ChainedLogOut>& out,
const ServerConfigurationListenerPrx& configurationListener,
const Ice::PropertiesPtr& props)
{
diff --git a/server/src/LoggingServer.h b/server/src/LoggingServer.h
index e8fea92..72c1525 100644
--- a/server/src/LoggingServer.h
+++ b/server/src/LoggingServer.h
@@ -64,7 +64,7 @@ class LoggingServerI : public LoggingServer
public:
ASTERISK_SCF_ICEBOX_EXPORT LoggingServerI();
- ASTERISK_SCF_ICEBOX_EXPORT void logs(const std::string& , Level,
+ ASTERISK_SCF_ICEBOX_EXPORT void logs(const std::string&, Level,
const std::string&, const Ice::Current&) const;
Configuration getConfiguration(const Ice::Current&) const
{
@@ -76,7 +76,7 @@ public:
ASTERISK_SCF_ICEBOX_EXPORT Level getEffectiveLevel(const std::string& name) const;
ASTERISK_SCF_ICEBOX_EXPORT void setLevel(const std::string& name, Level level);
- ASTERISK_SCF_ICEBOX_EXPORT void configure(boost::shared_ptr<ChainedLogOut> out, const ServerConfigurationListenerPrx& configurationListener, const Ice::PropertiesPtr& props);
+ ASTERISK_SCF_ICEBOX_EXPORT void configure(const boost::shared_ptr<ChainedLogOut>& out, const ServerConfigurationListenerPrx& configurationListener, const Ice::PropertiesPtr& props);
static const std::string LoggingPropertyPrefix;
diff --git a/server/src/OstreamChainedLogOut.h b/server/src/OstreamChainedLogOut.h
index 8e4aa63..1537807 100644
--- a/server/src/OstreamChainedLogOut.h
+++ b/server/src/OstreamChainedLogOut.h
@@ -32,11 +32,11 @@ namespace Logging
class OstreamChainedLogOut : public ChainedLogOut
{
public:
- OstreamChainedLogOut(std::ostream &out) :
+ OstreamChainedLogOut(std::ostream& out) :
ChainedLogOut(), mOut(out)
{
}
- OstreamChainedLogOut(std::ostream &out, boost::shared_ptr<ChainedLogOut> next) :
+ OstreamChainedLogOut(std::ostream& out, const boost::shared_ptr<ChainedLogOut>& next) :
ChainedLogOut(next), mOut(out)
{
}
@@ -47,7 +47,7 @@ protected:
private:
IceUtil::Mutex mOutMutex;
- std::ostream &mOut;
+ std::ostream& mOut;
};
} // Logging
diff --git a/server/src/main.cpp b/server/src/main.cpp
index ee68b66..73edd63 100644
--- a/server/src/main.cpp
+++ b/server/src/main.cpp
@@ -47,7 +47,7 @@ private:
void registerWithServiceLocator(const Ice::CommunicatorPtr& communicator,
const LoggingServerPrx& serverProxy);
void setupDefaultProperties(const Ice::CommunicatorPtr& communicator);
- void setDefaultProperty(Ice::Properties &properties, const std::string& key,
+ void setDefaultProperty(Ice::Properties& properties, const std::string& key,
const std::string& defaultValue);
};
}
@@ -87,7 +87,7 @@ void LoggingService::setupDefaultProperties(const Ice::CommunicatorPtr& communic
setDefaultProperty(*props, AdapterName + ".Endpoints", "default");
}
-void LoggingService::setDefaultProperty(Ice::Properties &props,
+void LoggingService::setDefaultProperty(Ice::Properties& props,
const std::string& key, const std::string& defaultValue)
{
if (props.getProperty(key).empty())
commit c2e94691c7b81a416efc2e4585ec3c558ee08c89
Author: David M. Lee <dlee at digium.com>
Date: Tue Nov 30 17:16:13 2010 -0600
Foo const & -> const Foo&
Ice generated files place const before types, and this has been copied
into the code in several places. Adjusting logger to be consistent.
Now if only I can retrain my fingers...
See CR-ASTSCF-4.
diff --git a/client/src/IceConfigurator.cpp b/client/src/IceConfigurator.cpp
index ef3e9a2..83740ef 100644
--- a/client/src/IceConfigurator.cpp
+++ b/client/src/IceConfigurator.cpp
@@ -29,19 +29,19 @@ namespace
* @param rhs Right hand side.
* @return True, if lhs < rhs.
*/
-bool operator<(SourceConfiguration const &lhs, SourceConfiguration const &rhs)
+bool operator<(const SourceConfiguration& lhs, const SourceConfiguration& rhs)
{
return lhs.name < rhs.name;
}
}
-void IceConfigurator::configured(Configuration const &logConfiguration,
- Ice::Current const &)
+void IceConfigurator::configured(const Configuration& logConfiguration,
+ const Ice::Current&)
{
return configured(logConfiguration);
}
-void IceConfigurator::configured(Configuration const &logConfiguration)
+void IceConfigurator::configured(const Configuration& logConfiguration)
{
std::vector<std::string> oldConfig = mFactory.getLoggerNames();
SourceConfigurationSeq newConfig = logConfiguration.sourceSettings;
@@ -101,7 +101,7 @@ void IceConfigurator::configured(Configuration const &logConfiguration)
}
IceConfiguratorPtr AsteriskSCF::System::Logging::createIceConfigurator(
- Ice::ObjectAdapterPtr const &adapter, LoggerFactory &factory)
+ const Ice::ObjectAdapterPtr& adapter, LoggerFactory &factory)
{
Ice::CommunicatorPtr communicator = adapter->getCommunicator();
@@ -127,7 +127,7 @@ IceConfiguratorPtr AsteriskSCF::System::Logging::createIceConfigurator(
"IceStorm not available. Cannot listen to config events.\n";
}
}
- catch (std::exception const &e)
+ catch (const std::exception& e)
{
std::clog << "(Logger) Error registering with IceStorm: " <<
e.what() << '\n';
diff --git a/client/src/IceConfigurator.h b/client/src/IceConfigurator.h
index 578d333..2d31bda 100644
--- a/client/src/IceConfigurator.h
+++ b/client/src/IceConfigurator.h
@@ -37,15 +37,15 @@ public:
{
}
- ASTERISK_SCF_ICEBOX_EXPORT void configured(Configuration const &logConfiguration, Ice::Current const &);
- ASTERISK_SCF_ICEBOX_EXPORT void configured(Configuration const &logConfiguration);
+ ASTERISK_SCF_ICEBOX_EXPORT void configured(const Configuration& logConfiguration, const Ice::Current&);
+ ASTERISK_SCF_ICEBOX_EXPORT void configured(const Configuration& logConfiguration);
private:
LoggerFactory &mFactory;
};
typedef IceUtil::Handle<IceConfigurator> IceConfiguratorPtr;
-ASTERISK_SCF_ICEBOX_EXPORT IceConfiguratorPtr createIceConfigurator(Ice::ObjectAdapterPtr const &adapter,
+ASTERISK_SCF_ICEBOX_EXPORT IceConfiguratorPtr createIceConfigurator(const Ice::ObjectAdapterPtr& adapter,
LoggerFactory &factory);
} // Logging
diff --git a/client/src/IceLogger.cpp b/client/src/IceLogger.cpp
index 8a0ee0f..edf47b0 100644
--- a/client/src/IceLogger.cpp
+++ b/client/src/IceLogger.cpp
@@ -24,8 +24,8 @@
using namespace AsteriskSCF::Core::Discovery::V1;
using namespace AsteriskSCF::System::Logging;
-void IceLogger::logs(std::string const &name, Level logLevel,
- std::string const &message)
+void IceLogger::logs(const std::string& name, Level logLevel,
+ const std::string& message)
{
bool logged = false;
try
@@ -36,7 +36,7 @@ void IceLogger::logs(std::string const &name, Level logLevel,
logged = true;
}
}
- catch (std::exception const &e)
+ catch (const std::exception& e)
{
std::clog << "(Logger) Failed to contact LoggerServer: " <<
e.what() << '\n';
@@ -57,12 +57,12 @@ void IceLogger::logs(std::string const &name, Level logLevel,
}
}
-ConfiguredIceLogger::ConfiguredIceLogger(LoggingServerPrx const &server)
+ConfiguredIceLogger::ConfiguredIceLogger(const LoggingServerPrx& server)
{
mLogger.setServer(server);
}
-ConfiguredIceLogger::ConfiguredIceLogger(ServiceLocatorPrx const &locator) :
+ConfiguredIceLogger::ConfiguredIceLogger(const ServiceLocatorPrx& locator) :
mLocator(locator)
{
//updateLoggerFromServiceLocator();
@@ -94,12 +94,12 @@ void ConfiguredIceLogger::locateFinished(const Ice::AsyncResultPtr &r)
mLogger.setServer(server);
}
}
- catch (Core::Discovery::V1::ServiceNotFound const &)
+ catch (const Core::Discovery::V1::ServiceNotFound&)
{
// couldn't find the service;
mLogger.setServer(LoggingServerPrx());
}
- catch (std::exception const &e)
+ catch (const std::exception& e)
{
std::clog << "(Logger) Failed to locate LoggerService: " <<
e.what() << '\n';
@@ -107,42 +107,42 @@ void ConfiguredIceLogger::locateFinished(const Ice::AsyncResultPtr &r)
}
}
-void ConfiguredIceLogger::comparisonRegistered(std::string const &guid,
- Ice::Current const &)
+void ConfiguredIceLogger::comparisonRegistered(const std::string& guid,
+ const Ice::Current&)
{
// no-op
}
-void ConfiguredIceLogger::comparisonUnregistered(std::string const &guid,
- Ice::Current const &)
+void ConfiguredIceLogger::comparisonUnregistered(const std::string& guid,
+ const Ice::Current&)
{
// no-op
}
-void ConfiguredIceLogger::serviceRegistered(std::string const &guid,
- Ice::Current const &)
+void ConfiguredIceLogger::serviceRegistered(const std::string& guid,
+ const Ice::Current&)
{
if (guid == LoggingServerGuid)
{
updateLoggerFromServiceLocator();
}
}
-void ConfiguredIceLogger::serviceUnregistered(std::string const &guid,
- Ice::Current const &)
+void ConfiguredIceLogger::serviceUnregistered(const std::string& guid,
+ const Ice::Current&)
{
if (guid == LoggingServerGuid)
{
updateLoggerFromServiceLocator();
}
}
-void ConfiguredIceLogger::serviceSuspended(std::string const &guid,
- Ice::Current const &)
+void ConfiguredIceLogger::serviceSuspended(const std::string& guid,
+ const Ice::Current&)
{
if (guid == LoggingServerGuid)
{
updateLoggerFromServiceLocator();
}
}
-void ConfiguredIceLogger::serviceUnsuspended(std::string const &guid,
- Ice::Current const &)
+void ConfiguredIceLogger::serviceUnsuspended(const std::string& guid,
+ const Ice::Current&)
{
if (guid == LoggingServerGuid)
{
@@ -151,7 +151,7 @@ void ConfiguredIceLogger::serviceUnsuspended(std::string const &guid,
}
ConfiguredIceLoggerPtr AsteriskSCF::System::Logging::createIceLogger(
- Ice::ObjectAdapterPtr const &adapter)
+ const Ice::ObjectAdapterPtr& adapter)
{
Ice::CommunicatorPtr communicator = adapter->getCommunicator();
@@ -166,7 +166,7 @@ ConfiguredIceLoggerPtr AsteriskSCF::System::Logging::createIceLogger(
LoggingServerPrx::checkedCast(server)));
}
}
- catch (std::exception const &e)
+ catch (const std::exception& e)
{
std::clog << "(Logger) Failed to contact LoggerServer: " <<
e.what() << '\n';
@@ -203,7 +203,7 @@ ConfiguredIceLoggerPtr AsteriskSCF::System::Logging::createIceLogger(
topic->subscribeAndGetPublisher(IceStorm::QoS(), proxy);
}
}
- catch (std::exception const &e)
+ catch (const std::exception& e)
{
std::clog << "(Logger) Failed to subscribe to " <<
Discovery::TOPIC << ": " << e.what() << '\n';
diff --git a/client/src/IceLogger.h b/client/src/IceLogger.h
index 43c6c0a..977bb4b 100644
--- a/client/src/IceLogger.h
+++ b/client/src/IceLogger.h
@@ -29,11 +29,11 @@ class IceLogger : public LogOut
public:
IceLogger() : hasPrintedNoServerNotice(false) {}
- void logs(std::string const &name, Level logLevel,
- std::string const &message);
+ void logs(const std::string& name, Level logLevel,
+ const std::string& message);
- LoggingServerPrx const &getServer() const { return mServer; }
- void setServer(LoggingServerPrx const &server) { this->mServer = server; }
+ const LoggingServerPrx& getServer() const { return mServer; }
+ void setServer(const LoggingServerPrx& server) { this->mServer = server; }
private:
LoggingServerPrx mServer;
@@ -52,24 +52,24 @@ public:
*
* @param server Server proxy to log to.
*/
- ConfiguredIceLogger(LoggingServerPrx const &server);
+ ConfiguredIceLogger(const LoggingServerPrx& server);
/**
* Configure an IceLogger which gets LoggingServer from the ServiceLocator.
*
* @param locator Locator to use to get the LoggingServer proxy.
*/
- ConfiguredIceLogger(Core::Discovery::V1::ServiceLocatorPrx const &locator);
+ ConfiguredIceLogger(const Core::Discovery::V1::ServiceLocatorPrx& locator);
LogOut &getLogger() { return mLogger; }
void updateLoggerFromServiceLocator();
- void comparisonRegistered(std::string const &guid, Ice::Current const &);
- void comparisonUnregistered(std::string const &guid, Ice::Current const &);
- void serviceRegistered(std::string const &guid, Ice::Current const &);
- void serviceUnregistered(std::string const &guid, Ice::Current const &);
- void serviceSuspended(std::string const &guid, Ice::Current const &);
- void serviceUnsuspended(std::string const &guid, Ice::Current const &);
+ void comparisonRegistered(const std::string& guid, const Ice::Current&);
+ void comparisonUnregistered(const std::string& guid, const Ice::Current&);
+ void serviceRegistered(const std::string& guid, const Ice::Current&);
+ void serviceUnregistered(const std::string& guid, const Ice::Current&);
+ void serviceSuspended(const std::string& guid, const Ice::Current&);
+ void serviceUnsuspended(const std::string& guid, const Ice::Current&);
private:
IceLogger mLogger;
@@ -96,7 +96,7 @@ typedef IceUtil::Handle<ConfiguredIceLogger> ConfiguredIceLoggerPtr;
* @return Smart pointer to a new ConfiguredIceLogger. Will never return null.
*/
ASTERISK_SCF_ICEBOX_EXPORT ConfiguredIceLoggerPtr createIceLogger(
- Ice::ObjectAdapterPtr const &adapter);
+ const Ice::ObjectAdapterPtr& adapter);
} // Logging
} // System
diff --git a/client/src/LogOut.h b/client/src/LogOut.h
index 67b7153..1fa9911 100644
--- a/client/src/LogOut.h
+++ b/client/src/LogOut.h
@@ -34,8 +34,8 @@ class LogOut
{
public:
ASTERISK_SCF_ICEBOX_EXPORT virtual ~LogOut();
- ASTERISK_SCF_ICEBOX_EXPORT virtual void logs(std::string const &name, Level logLevel,
- std::string const &message) = 0;
+ ASTERISK_SCF_ICEBOX_EXPORT virtual void logs(const std::string& name, Level logLevel,
+ const std::string& message) = 0;
};
diff --git a/client/src/Logger.cpp b/client/src/Logger.cpp
index 5bf8e63..de73b00 100644
--- a/client/src/Logger.cpp
+++ b/client/src/Logger.cpp
@@ -23,12 +23,12 @@ using namespace AsteriskSCF::System::Logging;
const int MESSAGE_SIZE = 120;
-LogBuf::LogBuf(LogOut &out, std::string const &name, Level logLevel) :
+LogBuf::LogBuf(LogOut &out, const std::string& name, Level logLevel) :
mOut(out), nName(name), mLogLevel(logLevel)
{
}
-LogBuf::LogBuf(LogBuf const &orig) :
+LogBuf::LogBuf(const LogBuf& orig) :
mOut(orig.mOut), nName(orig.nName), mLogLevel(orig.mLogLevel)
{
mBuffer.str(orig.mBuffer.str());
@@ -56,18 +56,18 @@ void LogBuf::sendBuffer()
{
// logic looks a bit backwards, but that's in case out.logs()
// throws an exception, we still want to clear the buffer.
- std::string const &message = mBuffer.str();
+ const std::string& message = mBuffer.str();
mBuffer.str("");
// send
mOut.logs(nName, mLogLevel, message);
}
-Logger::Logger(std::string const &name, LogOut &out, Level logLevel) :
+Logger::Logger(const std::string& name, LogOut &out, Level logLevel) :
mParent(0), mName(name), mOut(&out), mLogLevel(logLevel), mInheritedLevel(false)
{
}
-Logger::Logger(Logger const &parent, std::string const &name) :
+Logger::Logger(const Logger& parent, const std::string& name) :
mParent(&parent), mName(name), mOut(parent.mOut), mLogLevel(Off), mInheritedLevel(
true)
{
@@ -92,7 +92,7 @@ CondStream Logger::operator()(Level level) const
return CondStream(*mOut, mName, level, isEnabledFor(level));
}
-void Logger::logs(Level level, std::string const &message) const
+void Logger::logs(Level level, const std::string& message) const
{
if (isEnabledFor(level))
{
@@ -157,7 +157,7 @@ Level Logger::getEffectiveLevel() const
}
}
-Logger &Logger::getChild(std::string const &childName)
+Logger &Logger::getChild(const std::string& childName)
{
// ref to ptr allows us to update the map in-place
IceUtil::Mutex::Lock childLock(mChildrenMutex);
diff --git a/client/src/LoggerFactory.cpp b/client/src/LoggerFactory.cpp
index cf62c69..fe1dd01 100644
--- a/client/src/LoggerFactory.cpp
+++ b/client/src/LoggerFactory.cpp
@@ -55,7 +55,7 @@ LoggerFactory::LoggerFactory(LogOut &out) :
{
}
-Logger &LoggerFactory::getLogger(std::string const &name)
+Logger &LoggerFactory::getLogger(const std::string& name)
{
std::vector<std::string> path;
// older versions of boost output a single entry when splitting an empty
@@ -81,12 +81,12 @@ std::vector<std::string> LoggerFactory::getLoggerNames() const
return r;
}
-void LoggerFactory::accumulateLoggerNames(Logger const &logger, std::vector<
+void LoggerFactory::accumulateLoggerNames(const Logger& logger, std::vector<
std::string> &out)
{
out.push_back(logger.getName());
// recurse through the children
- std::vector<Logger const *> const &children = logger.getChildren();
+ std::vector<Logger const *>const & children = logger.getChildren();
for (std::vector<Logger const *>::const_iterator i = children.begin(); i
!= children.end(); ++i)
{
diff --git a/client/src/OstreamLogger.cpp b/client/src/OstreamLogger.cpp
index 8c21114..18869b6 100644
--- a/client/src/OstreamLogger.cpp
+++ b/client/src/OstreamLogger.cpp
@@ -30,8 +30,8 @@ public:
}
- void logs(std::string const &name, Level logLevel,
- std::string const &message)
+ void logs(const std::string& name, Level logLevel,
+ const std::string& message)
{
mOut << name << ":" << logLevel << ":" << message << '\n';
}
diff --git a/client/src/logger.h b/client/src/logger.h
index a6e7db0..ea56655 100644
--- a/client/src/logger.h
+++ b/client/src/logger.h
@@ -40,13 +40,13 @@ namespace Logging
class LogBuf : public std::streambuf
{
public:
- ASTERISK_SCF_ICEBOX_EXPORT LogBuf(LogOut &out, std::string const &name, Level logLevel);
+ ASTERISK_SCF_ICEBOX_EXPORT LogBuf(LogOut &out, const std::string& name, Level logLevel);
/**
* Copy ctor.
* @param orig Original.
*/
- ASTERISK_SCF_ICEBOX_EXPORT LogBuf(LogBuf const &orig);
+ ASTERISK_SCF_ICEBOX_EXPORT LogBuf(const LogBuf& orig);
ASTERISK_SCF_ICEBOX_EXPORT ~LogBuf();
@@ -72,7 +72,7 @@ private:
class CondStream
{
public:
- CondStream(LogOut &out, std::string const &name, Level logLevel,
+ CondStream(LogOut &out, const std::string& name, Level logLevel,
bool enabled) :
mBuf(out, name, logLevel), mStream(&mBuf), mEnabled(enabled)
{
@@ -82,7 +82,7 @@ public:
* Copy ctor.
* @param orig Original.
*/
- CondStream(CondStream const &orig) :
+ CondStream(const CondStream& orig) :
mBuf(orig.mBuf), mStream(&mBuf), mEnabled(orig.mEnabled)
{
@@ -94,7 +94,7 @@ public:
* @return this.
*/
template<typename T>
- CondStream &operator<<(T const &val);
+ CondStream &operator<<(const T& val);
/**
* Output operator for manipulators, such as endl.
@@ -117,7 +117,7 @@ private:
};
template<typename T>
-inline CondStream &CondStream::operator<<(T const &val)
+inline CondStream &CondStream::operator<<(const T& val)
{
if (mEnabled)
{
@@ -144,12 +144,12 @@ public:
/**
* Construct a root Logger.
*/
- ASTERISK_SCF_ICEBOX_EXPORT Logger(std::string const &name, LogOut &out, Level logLevel = Debug);
+ ASTERISK_SCF_ICEBOX_EXPORT Logger(const std::string& name, LogOut &out, Level logLevel = Debug);
/**
* Construct a child Logger.
*/
- ASTERISK_SCF_ICEBOX_EXPORT Logger(Logger const &parent, std::string const &name);
+ ASTERISK_SCF_ICEBOX_EXPORT Logger(const Logger& parent, const std::string& name);
ASTERISK_SCF_ICEBOX_EXPORT ~Logger();
@@ -175,7 +175,7 @@ public:
/**
* Log a single message.
*/
- ASTERISK_SCF_ICEBOX_EXPORT void logs(Level level, std::string const &message) const;
+ ASTERISK_SCF_ICEBOX_EXPORT void logs(Level level, const std::string& message) const;
/**
* Log a single printf-formatted message.
@@ -192,10 +192,10 @@ public:
return mParent;
}
- ASTERISK_SCF_ICEBOX_EXPORT Logger &getChild(std::string const &childName);
+ ASTERISK_SCF_ICEBOX_EXPORT Logger &getChild(const std::string& childName);
ASTERISK_SCF_ICEBOX_EXPORT std::vector<Logger const *> getChildren() const;
- ASTERISK_SCF_ICEBOX_EXPORT std::string const &getName() const
+ ASTERISK_SCF_ICEBOX_EXPORT const std::string& getName() const
{
return mName;
}
@@ -225,8 +225,8 @@ public:
private:
// non-copyable
- Logger(Logger const &);
- Logger const &operator=(Logger const &);
+ Logger(const Logger&);
+ const Logger& operator=(const Logger&);
/**
* Mutex for access to the children field.
@@ -277,7 +277,7 @@ public:
* @return Ref to the Logger.
* @thread-safe
*/
- ASTERISK_SCF_ICEBOX_EXPORT Logger &getLogger(std::string const &name);
+ ASTERISK_SCF_ICEBOX_EXPORT Logger &getLogger(const std::string& name);
/**
* Returns a vector of the names of all currently configured Logger's.
@@ -290,7 +290,7 @@ public:
private:
Logger mRoot;
- static void accumulateLoggerNames(Logger const &logger, std::vector<std::string> &out);
+ static void accumulateLoggerNames(const Logger& logger, std::vector<std::string> &out);
};
ASTERISK_SCF_ICEBOX_EXPORT boost::shared_ptr<LogOut> buildOstreamLogger(std::ostream &out);
diff --git a/client/test/ExpectedLogOut.h b/client/test/ExpectedLogOut.h
index 418bfc9..1c964f7 100644
--- a/client/test/ExpectedLogOut.h
+++ b/client/test/ExpectedLogOut.h
@@ -23,13 +23,13 @@ namespace Logging
class ExpectedLogOut : public LogOut
{
public:
- ExpectedLogOut(std::string const &expected) :
+ ExpectedLogOut(const std::string& expected) :
expected(expected)
{
}
- void logs(std::string const &name, Level logLevel,
- std::string const &message)
+ void logs(const std::string& name, Level logLevel,
+ const std::string& message)
{
actual << name << ":" << logLevel << ":" << message << '\n';
}
diff --git a/client/test/IceConfigurator-test.cpp b/client/test/IceConfigurator-test.cpp
index ab4caee..a546fab 100644
--- a/client/test/IceConfigurator-test.cpp
+++ b/client/test/IceConfigurator-test.cpp
@@ -24,7 +24,7 @@ using namespace AsteriskSCF::System::Logging;
namespace
{
-void addConfig(Configuration &cfg, std::string const &name, Level logLevel)
+void addConfig(Configuration &cfg, const std::string& name, Level logLevel)
{
SourceConfiguration sourceConfig = {};
sourceConfig.name = name;
diff --git a/client/test/LoggerFactory-test.cpp b/client/test/LoggerFactory-test.cpp
index b6d8a07..171d262 100644
--- a/client/test/LoggerFactory-test.cpp
+++ b/client/test/LoggerFactory-test.cpp
@@ -29,8 +29,8 @@ BOOST_AUTO_TEST_CASE(testGetDistinct)
boost::shared_ptr<LogOut> logOut = buildOstreamLogger(tmp);
LoggerFactory uut(*logOut);
- Logger const &asteriskScf = uut.getLogger("AsteriskSCF");
- Logger const &core = uut.getLogger("AsteriskSCF.Core");
+ const Logger& asteriskScf = uut.getLogger("AsteriskSCF");
+ const Logger& core = uut.getLogger("AsteriskSCF.Core");
BOOST_CHECK_NE(&core, &asteriskScf);
BOOST_CHECK_EQUAL(&asteriskScf, core.getParent());
diff --git a/client/test/scf-log.cpp b/client/test/scf-log.cpp
index 07d88e8..5728e10 100644
--- a/client/test/scf-log.cpp
+++ b/client/test/scf-log.cpp
@@ -43,8 +43,8 @@ public:
void usage(std::ostream &out);
private:
void setupDefaultProperties();
- void setDefaultProperty(Ice::Properties &properties, std::string const &key,
- std::string const &defaultValue);
+ void setDefaultProperty(Ice::Properties &properties, const std::string& key,
+ const std::string& defaultValue);
};
} // namespace
@@ -129,7 +129,7 @@ void ScfLogClientApplication::setupDefaultProperties()
}
void ScfLogClientApplication::setDefaultProperty(Ice::Properties &props,
- std::string const &key, std::string const &defaultValue)
+ const std::string& key, const std::string& defaultValue)
{
if (props.getProperty(key).empty())
{
diff --git a/common/Level.h b/common/Level.h
index 71e7994..4f31f38 100644
--- a/common/Level.h
+++ b/common/Level.h
@@ -48,7 +48,7 @@ inline std::ostream &operator<<(std::ostream &o, Level level)
return o << "Unknown(" << level << ")";
}
-inline Level parseString(std::string const &str)
+inline Level parseString(const std::string& str)
{
if (str == "Debug")
{
diff --git a/server/src/ChainedLogOut.cpp b/server/src/ChainedLogOut.cpp
index 1f7a71c..3d53774 100644
--- a/server/src/ChainedLogOut.cpp
+++ b/server/src/ChainedLogOut.cpp
@@ -42,8 +42,8 @@ ChainedLogOut::~ChainedLogOut()
// no-op
}
-void ChainedLogOut::logs(std::string const &name, Level logLevel,
- std::string const &message)
+void ChainedLogOut::logs(const std::string& name, Level logLevel,
+ const std::string& message)
{
myLogs(name, logLevel, message);
if (mNext.get())
@@ -52,8 +52,8 @@ void ChainedLogOut::logs(std::string const &name, Level logLevel,
}
}
-std::ostream &ChainedLogOut::logs(std::ostream &out, std::string const &name,
- Level logLevel, std::string const &message)
+std::ostream &ChainedLogOut::logs(std::ostream &out, const std::string& name,
+ Level logLevel, const std::string& message)
{
// date level name(1) message
std::string::size_type lastDot = name.rfind('.');
diff --git a/server/src/ChainedLogOut.h b/server/src/ChainedLogOut.h
index 57a8dbc..4d34025 100644
--- a/server/src/ChainedLogOut.h
+++ b/server/src/ChainedLogOut.h
@@ -48,8 +48,8 @@ public:
* @param logLevel Level of the message.
* @param message Message.
*/
- void logs(std::string const &name, Level logLevel,
- std::string const &message);
+ void logs(const std::string& name, Level logLevel,
+ const std::string& message);
/**
* Convenient method for logging messages to an ostream, so we have a consistent
@@ -59,12 +59,12 @@ public:
* @param message Message.
* @return out
*/
- static std::ostream &logs(std::ostream &out, std::string const &name,
- Level logLevel, std::string const &message);
+ static std::ostream &logs(std::ostream &out, const std::string& name,
+ Level logLevel, const std::string& message);
protected:
- virtual void myLogs(std::string const &name, Level logLevel,
- std::string const &message) = 0;
+ virtual void myLogs(const std::string& name, Level logLevel,
+ const std::string& message) = 0;
boost::shared_ptr<ChainedLogOut> mNext;
};
diff --git a/server/src/FileChainedLogOut.cpp b/server/src/FileChainedLogOut.cpp
index 3cfc889..5c26433 100644
--- a/server/src/FileChainedLogOut.cpp
+++ b/server/src/FileChainedLogOut.cpp
@@ -26,8 +26,8 @@ void FileChainedLogOut::reopen()
mOut.close();
}
-void FileChainedLogOut::myLogs(std::string const &name, Level logLevel,
- std::string const &message)
+void FileChainedLogOut::myLogs(const std::string& name, Level logLevel,
+ const std::string& message)
{
IceUtil::Mutex::Lock lock(mFileMutex);
if (!mOut || !mOut.is_open())
diff --git a/server/src/FileChainedLogOut.h b/server/src/FileChainedLogOut.h
index 2e4f3da..89958c6 100644
--- a/server/src/FileChainedLogOut.h
+++ b/server/src/FileChainedLogOut.h
@@ -32,11 +32,11 @@ namespace Logging
class FileChainedLogOut : public ChainedLogOut
{
public:
- FileChainedLogOut(std::string const &logFile) :
+ FileChainedLogOut(const std::string& logFile) :
ChainedLogOut(), mLogFile(logFile)
{
}
- FileChainedLogOut(std::string const &logFile, boost::shared_ptr<ChainedLogOut> next) :
+ FileChainedLogOut(const std::string& logFile, boost::shared_ptr<ChainedLogOut> next) :
ChainedLogOut(next), mLogFile(logFile)
{
}
@@ -47,8 +47,8 @@ public:
void reopen();
protected:
- void myLogs(std::string const &name, Level logLevel,
- std::string const &message);
+ void myLogs(const std::string& name, Level logLevel,
+ const std::string& message);
private:
IceUtil::Mutex mFileMutex;
diff --git a/server/src/LoggingServer.cpp b/server/src/LoggingServer.cpp
index 0f7093d..18b8d40 100644
--- a/server/src/LoggingServer.cpp
+++ b/server/src/LoggingServer.cpp
@@ -33,12 +33,12 @@ LoggingServerI::LoggingServerI()
mSources[""] = SourceNode();
}
-bool LoggingServerI::isEnabledFor(std::string const &name, Level level) const
+bool LoggingServerI::isEnabledFor(const std::string& name, Level level) const
{
return getEffectiveLevel(name) <= level;
}
-Level LoggingServerI::getEffectiveLevel(std::string const &name) const
+Level LoggingServerI::getEffectiveLevel(const std::string& name) const
{
// thread safety
IceUtil::Mutex::Lock sourcesLock(mSourcesMutex);
@@ -59,7 +59,7 @@ Level LoggingServerI::getEffectiveLevel(std::string const &name) const
return Off;
}
-void LoggingServerI::setLevel(std::string const &name, Level level)
+void LoggingServerI::setLevel(const std::string& name, Level level)
{
{
// thread safety. getConfiguration needs the lock, so we need to release
@@ -74,7 +74,7 @@ void LoggingServerI::setLevel(std::string const &name, Level level)
}
}
-void LoggingServerI::logs(std::string const &name, Level level,
+void LoggingServerI::logs(const std::string& name, Level level,
const std::string &message, const Ice::Current&) const
{
if (isEnabledFor(name, level))
@@ -112,8 +112,8 @@ Configuration LoggingServerI::getConfiguration() const
return r;
}
-bool LoggingServerI::isSubpathOf(std::string const &path,
- std::string const &subpath)
+bool LoggingServerI::isSubpathOf(const std::string& path,
+ const std::string& subpath)
{
// if path begins with subpath
if (path.compare(0, subpath.size(), subpath) == 0)
@@ -140,8 +140,8 @@ bool LoggingServerI::isSubpathOf(std::string const &path,
// <prefix>.logger=level
// <prefix>.logger.<name>=level
void LoggingServerI::configure(boost::shared_ptr<ChainedLogOut> out,
- ServerConfigurationListenerPrx const &configurationListener,
- Ice::PropertiesPtr const &props)
+ const ServerConfigurationListenerPrx& configurationListener,
+ const Ice::PropertiesPtr& props)
{
this->mOut = out;
this->mConfigurationListener = configurationListener;
@@ -158,7 +158,7 @@ void LoggingServerI::configure(boost::shared_ptr<ChainedLogOut> out,
}
else if (i->first.find(LoggerPrefix) == 0)
{
- std::string const &name = i->first.substr(LoggerPrefix.size());
+ const std::string& name = i->first.substr(LoggerPrefix.size());
setLevel(name, parseString(i->second));
}
else
diff --git a/server/src/LoggingServer.h b/server/src/LoggingServer.h
index ab9b76b..e8fea92 100644
--- a/server/src/LoggingServer.h
+++ b/server/src/LoggingServer.h
@@ -64,19 +64,19 @@ class LoggingServerI : public LoggingServer
public:
ASTERISK_SCF_ICEBOX_EXPORT LoggingServerI();
- ASTERISK_SCF_ICEBOX_EXPORT void logs(std::string const &, Level,
+ ASTERISK_SCF_ICEBOX_EXPORT void logs(const std::string& , Level,
const std::string&, const Ice::Current&) const;
- Configuration getConfiguration(Ice::Current const &) const
+ Configuration getConfiguration(const Ice::Current&) const
{
return getConfiguration();
}
ASTERISK_SCF_ICEBOX_EXPORT Configuration getConfiguration() const;
- ASTERISK_SCF_ICEBOX_EXPORT bool isEnabledFor(std::string const &name, Level level) const;
- ASTERISK_SCF_ICEBOX_EXPORT Level getEffectiveLevel(std::string const &name) const;
- ASTERISK_SCF_ICEBOX_EXPORT void setLevel(std::string const &name, Level level);
+ ASTERISK_SCF_ICEBOX_EXPORT bool isEnabledFor(const std::string& name, Level level) const;
+ ASTERISK_SCF_ICEBOX_EXPORT Level getEffectiveLevel(const std::string& name) const;
+ ASTERISK_SCF_ICEBOX_EXPORT void setLevel(const std::string& name, Level level);
- ASTERISK_SCF_ICEBOX_EXPORT void configure(boost::shared_ptr<ChainedLogOut> out, ServerConfigurationListenerPrx const &configurationListener, Ice::PropertiesPtr const &props);
+ ASTERISK_SCF_ICEBOX_EXPORT void configure(boost::shared_ptr<ChainedLogOut> out, const ServerConfigurationListenerPrx& configurationListener, const Ice::PropertiesPtr& props);
static const std::string LoggingPropertyPrefix;
@@ -92,7 +92,7 @@ private:
* @param subpath Subpath to look for.
* @return true if subpath is a subpath of path.
*/
- static bool isSubpathOf(std::string const &path, std::string const &subpath);
+ static bool isSubpathOf(const std::string& path, const std::string& subpath);
IceUtil::Mutex mSourcesMutex;
Sources mSources;
diff --git a/server/src/OstreamChainedLogOut.cpp b/server/src/OstreamChainedLogOut.cpp
index c7e00dc..12757af 100644
--- a/server/src/OstreamChainedLogOut.cpp
+++ b/server/src/OstreamChainedLogOut.cpp
@@ -20,8 +20,8 @@
using namespace AsteriskSCF::System::Logging;
-void OstreamChainedLogOut::myLogs(std::string const &name, Level logLevel,
- std::string const &message)
+void OstreamChainedLogOut::myLogs(const std::string& name, Level logLevel,
+ const std::string& message)
{
IceUtil::Mutex::Lock lock(mOutMutex);
logs(mOut, name, logLevel, message);
diff --git a/server/src/OstreamChainedLogOut.h b/server/src/OstreamChainedLogOut.h
index 88d4a51..8e4aa63 100644
--- a/server/src/OstreamChainedLogOut.h
+++ b/server/src/OstreamChainedLogOut.h
@@ -42,8 +42,8 @@ public:
}
protected:
- void myLogs(std::string const &name, Level logLevel,
- std::string const &message);
+ void myLogs(const std::string& name, Level logLevel,
+ const std::string& message);
private:
IceUtil::Mutex mOutMutex;
diff --git a/server/src/main.cpp b/server/src/main.cpp
index 79c6cb8..ee68b66 100644
--- a/server/src/main.cpp
+++ b/server/src/main.cpp
@@ -36,25 +36,25 @@ const std::string LogFileName = "asterisk-scf.log";
class LoggingService : public IceBox::Service
{
protected:
- void start(std::string const &name,
- Ice::CommunicatorPtr const &communicator,
- Ice::StringSeq const &args);
+ void start(const std::string& name,
+ const Ice::CommunicatorPtr& communicator,
+ const Ice::StringSeq& args);
void stop();
private:
Ice::ObjectAdapterPtr mAdapter;
ServiceManagementPrx mServiceManagement;
- void registerWithServiceLocator(Ice::CommunicatorPtr const &communicator,
- LoggingServerPrx const &serverProxy);
- void setupDefaultProperties(Ice::CommunicatorPtr const &communicator);
- void setDefaultProperty(Ice::Properties &properties, std::string const &key,
- std::string const &defaultValue);
+ void registerWithServiceLocator(const Ice::CommunicatorPtr& communicator,
+ const LoggingServerPrx& serverProxy);
+ void setupDefaultProperties(const Ice::CommunicatorPtr& communicator);
+ void setDefaultProperty(Ice::Properties &properties, const std::string& key,
+ const std::string& defaultValue);
};
}
void LoggingService::registerWithServiceLocator(
- Ice::CommunicatorPtr const &communicator,
- LoggingServerPrx const &serverProxy)
+ const Ice::CommunicatorPtr& communicator,
+ const LoggingServerPrx& serverProxy)
{
try
{
@@ -73,14 +73,14 @@ void LoggingService::registerWithServiceLocator(
mServiceManagement->addLocatorParams(params, "");
}
}
- catch (std::exception const &e)
+ catch (const std::exception& e)
{
std::clog << "Logger failed to register with ServiceLocator (Ignoring): ";
std::clog << e.what() << '\n';
}
}
-void LoggingService::setupDefaultProperties(Ice::CommunicatorPtr const &communicator)
+void LoggingService::setupDefaultProperties(const Ice::CommunicatorPtr& communicator)
{
Ice::PropertiesPtr props = communicator->getProperties();
@@ -88,7 +88,7 @@ void LoggingService::setupDefaultProperties(Ice::CommunicatorPtr const &communic
}
void LoggingService::setDefaultProperty(Ice::Properties &props,
- std::string const &key, std::string const &defaultValue)
+ const std::string& key, const std::string& defaultValue)
{
if (props.getProperty(key).empty())
{
@@ -96,9 +96,9 @@ void LoggingService::setDefaultProperty(Ice::Properties &props,
}
}
-void LoggingService::start(std::string const &name,
- Ice::CommunicatorPtr const &communicator,
- Ice::StringSeq const &args)
+void LoggingService::start(const std::string& name,
+ const Ice::CommunicatorPtr& communicator,
+ const Ice::StringSeq& args)
{
setupDefaultProperties(communicator);
@@ -121,13 +121,13 @@ void LoggingService::start(std::string const &name,
{
topic = topicManager->retrieve(ServerConfigurationTopic);
}
- catch (IceStorm::NoSuchTopic const &e)
+ catch (const IceStorm::NoSuchTopic& e)
{
try
{
topic = topicManager->create(ServerConfigurationTopic);
}
- catch (IceStorm::TopicExists const &e)
+ catch (const IceStorm::TopicExists& e)
{
// we had a race to create the object w/ someone else
// and lost
@@ -143,7 +143,7 @@ void LoggingService::start(std::string const &name,
<< "IceStorm unavailable. Cannot send configuration updates.\n";
}
}
- catch (std::exception const &e)
+ catch (const std::exception& e)
{
std::clog << "Failed to contact ServiceLocator: ";
std::clog << e.what() << '\n';
commit ce75bfdf27c7e2d40d178f2f4db41bf78a3d0a02
Author: David M. Lee <dlee at digium.com>
Date: Tue Nov 30 16:35:55 2010 -0600
std::auto_ptr -> boost::shared_ptr
auto_ptr has been deprecated from C++0x, but we can't rely on
std::shared_ptr quite yet. As a compromise, we'll use boost::shared_ptr
until we can rely on C++0x features.
See CR-ASTSCF-4.
diff --git a/client/src/LoggerFactory.cpp b/client/src/LoggerFactory.cpp
index eb3eaec..cf62c69 100644
--- a/client/src/LoggerFactory.cpp
+++ b/client/src/LoggerFactory.cpp
@@ -37,7 +37,7 @@ LoggerFactory *loggerFactory = 0;
void initLoggerFactory()
{
- static std::auto_ptr<LogOut> out = buildOstreamLogger(std::cout);
+ static boost::shared_ptr<LogOut> out = buildOstreamLogger(std::cout);
static LoggerFactory singleton(*out);
loggerFactory = &singleton;
}
diff --git a/client/src/OstreamLogger.cpp b/client/src/OstreamLogger.cpp
index f108629..8c21114 100644
--- a/client/src/OstreamLogger.cpp
+++ b/client/src/OstreamLogger.cpp
@@ -42,7 +42,7 @@ private:
}
-std::auto_ptr<LogOut> AsteriskSCF::System::Logging::buildOstreamLogger(std::ostream &out)
+boost::shared_ptr<LogOut> AsteriskSCF::System::Logging::buildOstreamLogger(std::ostream &out)
{
- return std::auto_ptr<LogOut>(new OstreamLogger(out));
+ return boost::shared_ptr<LogOut>(new OstreamLogger(out));
}
diff --git a/client/src/logger.h b/client/src/logger.h
index 337d589..a6e7db0 100644
--- a/client/src/logger.h
+++ b/client/src/logger.h
@@ -18,7 +18,8 @@
#include <ostream>
#include <cstdarg>
-#include <memory>
+
+#include <boost/shared_ptr.hpp>
#include "System/Logger/LoggerIf.h"
#include "Level.h"
@@ -292,7 +293,7 @@ private:
static void accumulateLoggerNames(Logger const &logger, std::vector<std::string> &out);
};
-ASTERISK_SCF_ICEBOX_EXPORT std::auto_ptr<LogOut> buildOstreamLogger(std::ostream &out);
+ASTERISK_SCF_ICEBOX_EXPORT boost::shared_ptr<LogOut> buildOstreamLogger(std::ostream &out);
/**
* Returns the default configured LoggerFactory.
diff --git a/client/test/LoggerFactory-test.cpp b/client/test/LoggerFactory-test.cpp
index ceeb2dd..b6d8a07 100644
--- a/client/test/LoggerFactory-test.cpp
+++ b/client/test/LoggerFactory-test.cpp
@@ -26,7 +26,7 @@ BOOST_AUTO_TEST_SUITE(LoggerFactoryTest)
BOOST_AUTO_TEST_CASE(testGetDistinct)
{
std::stringstream tmp;
- std::auto_ptr<LogOut> logOut = buildOstreamLogger(tmp);
+ boost::shared_ptr<LogOut> logOut = buildOstreamLogger(tmp);
LoggerFactory uut(*logOut);
Logger const &asteriskScf = uut.getLogger("AsteriskSCF");
@@ -40,7 +40,7 @@ BOOST_AUTO_TEST_CASE(testGetDistinct)
BOOST_AUTO_TEST_CASE(testInheritence_off)
{
std::stringstream actual;
- std::auto_ptr<LogOut> logOut = buildOstreamLogger(actual);
+ boost::shared_ptr<LogOut> logOut = buildOstreamLogger(actual);
LoggerFactory uut(*logOut);
Logger &root = uut.getLogger("");
@@ -55,7 +55,7 @@ BOOST_AUTO_TEST_CASE(testInheritence_off)
BOOST_AUTO_TEST_CASE(testInheritence_on)
{
std::stringstream actual;
- std::auto_ptr<LogOut> logOut = buildOstreamLogger(actual);
+ boost::shared_ptr<LogOut> logOut = buildOstreamLogger(actual);
LoggerFactory uut(*logOut);
Logger &root = uut.getLogger("");
diff --git a/server/src/ChainedLogOut.h b/server/src/ChainedLogOut.h
index 818c4c8..57a8dbc 100644
--- a/server/src/ChainedLogOut.h
+++ b/server/src/ChainedLogOut.h
@@ -16,11 +16,11 @@
#pragma once
-#include <memory>
-#include "Level.h"
+#include <iomanip>
+#include <boost/shared_ptr.hpp>
-#include <iomanip>
+#include "Level.h"
namespace AsteriskSCF
{
@@ -35,7 +35,7 @@ public:
ChainedLogOut()
{
}
- ChainedLogOut(std::auto_ptr<ChainedLogOut> next) :
+ ChainedLogOut(boost::shared_ptr<ChainedLogOut> next) :
mNext(next)
{
}
@@ -66,7 +66,7 @@ protected:
virtual void myLogs(std::string const &name, Level logLevel,
std::string const &message) = 0;
- std::auto_ptr<ChainedLogOut> mNext;
+ boost::shared_ptr<ChainedLogOut> mNext;
};
} // Logging
diff --git a/server/src/FileChainedLogOut.h b/server/src/FileChainedLogOut.h
index d84f2eb..2e4f3da 100644
--- a/server/src/FileChainedLogOut.h
+++ b/server/src/FileChainedLogOut.h
@@ -36,7 +36,7 @@ public:
ChainedLogOut(), mLogFile(logFile)
{
}
- FileChainedLogOut(std::string const &logFile, std::auto_ptr<ChainedLogOut> next) :
+ FileChainedLogOut(std::string const &logFile, boost::shared_ptr<ChainedLogOut> next) :
ChainedLogOut(next), mLogFile(logFile)
{
}
diff --git a/server/src/LoggingServer.cpp b/server/src/LoggingServer.cpp
index 6a65a12..0f7093d 100644
--- a/server/src/LoggingServer.cpp
+++ b/server/src/LoggingServer.cpp
@@ -139,7 +139,7 @@ bool LoggingServerI::isSubpathOf(std::string const &path,
// <prefix>.logger=level
// <prefix>.logger.<name>=level
-void LoggingServerI::configure(std::auto_ptr<ChainedLogOut> out,
... 209 lines suppressed ...
--
asterisk-scf/integration/logger.git
More information about the asterisk-scf-commits
mailing list