[asterisk-scf-commits] asterisk-scf/integration/logger.git branch "master" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Fri Oct 1 13:57:44 CDT 2010
branch "master" has been updated
via 8cbc97a73e0196d39aa727fc55ba4c0d5b9c9161 (commit)
via ad8de890cfb693dbc7ba6dddc95ce3bf29ea81fa (commit)
from 68e5ffd82711321f62dea4da1f3d9d57ea46a13d (commit)
Summary of changes:
client/src/IceConfigurator.cpp | 8 ++--
client/src/IceConfigurator.h | 4 +-
client/src/IceLogger.cpp | 16 ++++----
client/src/IceLogger.h | 12 +++---
client/src/Logger.cpp | 66 +++++++++++++++++-----------------
client/src/LoggerFactory.cpp | 8 ++--
client/src/OstreamLogger.cpp | 6 ++--
client/src/logger.h | 48 +++++++++++++-------------
server/src/ChainedLogOut.cpp | 4 +-
server/src/ChainedLogOut.h | 4 +-
server/src/FileChainedLogOut.cpp | 14 ++++----
server/src/FileChainedLogOut.h | 10 +++---
server/src/LoggingServer.cpp | 34 +++++++++---------
server/src/LoggingServer.h | 22 ++++++------
server/src/OstreamChainedLogOut.cpp | 4 +-
server/src/OstreamChainedLogOut.h | 8 ++--
server/src/main.cpp | 18 +++++-----
17 files changed, 143 insertions(+), 143 deletions(-)
- Log -----------------------------------------------------------------
commit 8cbc97a73e0196d39aa727fc55ba4c0d5b9c9161
Author: David M. Lee <dlee at digium.com>
Date: Fri Oct 1 13:56:51 2010 -0500
Hungarian-ise the server
diff --git a/server/src/ChainedLogOut.cpp b/server/src/ChainedLogOut.cpp
index c96abd0..506ea7f 100644
--- a/server/src/ChainedLogOut.cpp
+++ b/server/src/ChainedLogOut.cpp
@@ -38,9 +38,9 @@ void ChainedLogOut::logs(std::string const &name, Level logLevel,
std::string const &message)
{
myLogs(name, logLevel, message);
- if (next.get())
+ if (mNext.get())
{
- next->logs(name, logLevel, message);
+ mNext->logs(name, logLevel, message);
}
}
diff --git a/server/src/ChainedLogOut.h b/server/src/ChainedLogOut.h
index 3587671..8b19226 100644
--- a/server/src/ChainedLogOut.h
+++ b/server/src/ChainedLogOut.h
@@ -28,7 +28,7 @@ public:
{
}
ChainedLogOut(std::auto_ptr<ChainedLogOut> next) :
- next(next)
+ mNext(next)
{
}
virtual ~ChainedLogOut();
@@ -58,7 +58,7 @@ protected:
virtual void myLogs(std::string const &name, Level logLevel,
std::string const &message) = 0;
- std::auto_ptr<ChainedLogOut> next;
+ std::auto_ptr<ChainedLogOut> mNext;
};
} // Logging
diff --git a/server/src/FileChainedLogOut.cpp b/server/src/FileChainedLogOut.cpp
index 4732916..557d3a5 100644
--- a/server/src/FileChainedLogOut.cpp
+++ b/server/src/FileChainedLogOut.cpp
@@ -14,23 +14,23 @@ using namespace AsteriskSCF::System::Logging;
void FileChainedLogOut::reopen()
{
- IceUtil::Mutex::Lock lock(fileMutex);
- out.close();
+ IceUtil::Mutex::Lock lock(mFileMutex);
+ mOut.close();
}
void FileChainedLogOut::myLogs(std::string const &name, Level logLevel,
std::string const &message)
{
- IceUtil::Mutex::Lock lock(fileMutex);
- if (!out || !out.is_open())
+ IceUtil::Mutex::Lock lock(mFileMutex);
+ if (!mOut || !mOut.is_open())
{
// reopen the file
- out.open(logFile.c_str());
+ mOut.open(mLogFile.c_str());
}
- if (out && out.is_open())
+ if (mOut && mOut.is_open())
{
- logs(out, name, logLevel, message);
+ logs(mOut, name, logLevel, message);
}
else
{
diff --git a/server/src/FileChainedLogOut.h b/server/src/FileChainedLogOut.h
index 7054b3c..46c682c 100644
--- a/server/src/FileChainedLogOut.h
+++ b/server/src/FileChainedLogOut.h
@@ -25,11 +25,11 @@ class FileChainedLogOut : public ChainedLogOut
{
public:
FileChainedLogOut(std::string const &logFile) :
- ChainedLogOut(), logFile(logFile)
+ ChainedLogOut(), mLogFile(logFile)
{
}
FileChainedLogOut(std::string const &logFile, std::auto_ptr<ChainedLogOut> next) :
- ChainedLogOut(next), logFile(logFile)
+ ChainedLogOut(next), mLogFile(logFile)
{
}
@@ -43,9 +43,9 @@ protected:
std::string const &message);
private:
- IceUtil::Mutex fileMutex;
- const std::string logFile;
- std::ofstream out;
+ IceUtil::Mutex mFileMutex;
+ const std::string mLogFile;
+ std::ofstream mOut;
};
} // Logging
diff --git a/server/src/LoggingServer.cpp b/server/src/LoggingServer.cpp
index 07c81f6..2dace28 100644
--- a/server/src/LoggingServer.cpp
+++ b/server/src/LoggingServer.cpp
@@ -22,7 +22,7 @@ const std::string LoggerPrefix = LoggingServerI::LoggingPropertyPrefix
LoggingServerI::LoggingServerI()
{
- sources[""] = SourceNode();
+ mSources[""] = SourceNode();
}
bool LoggingServerI::isEnabledFor(std::string const &name, Level level) const
@@ -33,17 +33,17 @@ bool LoggingServerI::isEnabledFor(std::string const &name, Level level) const
Level LoggingServerI::getEffectiveLevel(std::string const &name) const
{
// thread safety
- IceUtil::Mutex::Lock sourcesLock(sourcesMutex);
+ 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 = sources.lower_bound(name); i
- != sources.end(); ++i)
+ for (Sources::const_iterator i = mSources.lower_bound(name); i
+ != mSources.end(); ++i)
{
if (isSubpathOf(name, i->first))
{
- return i->second.getLevel();
+ return i->second.getLogLevel();
}
}
@@ -56,13 +56,13 @@ void LoggingServerI::setLevel(std::string const &name, Level level)
{
// thread safety. getConfiguration needs the lock, so we need to release
// it prior to that call.
- IceUtil::Mutex::Lock sourcesLock(sourcesMutex);
- sources[name].setLevel(level);
+ IceUtil::Mutex::Lock sourcesLock(mSourcesMutex);
+ mSources[name].setLogLevel(level);
}
- if (configurationListener)
+ if (mConfigurationListener)
{
- configurationListener->configured(getConfiguration());
+ mConfigurationListener->configured(getConfiguration());
}
}
@@ -71,9 +71,9 @@ void LoggingServerI::logs(std::string const &name, Level level,
{
if (isEnabledFor(name, level))
{
- if (out.get())
+ if (mOut.get())
{
- out->logs(name, level, message);
+ mOut->logs(name, level, message);
}
else
{
@@ -88,17 +88,17 @@ Configuration LoggingServerI::getConfiguration() const
Configuration r;
// thread safety
- IceUtil::Mutex::Lock sourcesLock(sourcesMutex);
+ IceUtil::Mutex::Lock sourcesLock(mSourcesMutex);
// reverse sorted is a bit confusing for the outside world, so
// double-reverse for a normal sort.
- for (Sources::const_reverse_iterator i = sources.rbegin(); i
- != sources.rend(); ++i)
+ for (Sources::const_reverse_iterator i = mSources.rbegin(); i
+ != mSources.rend(); ++i)
{
SourceConfiguration v =
{ };
v.name = i->first;
- v.logLevel = i->second.getLevel();
+ v.logLevel = i->second.getLogLevel();
r.sourceSettings.push_back(v);
}
return r;
@@ -135,8 +135,8 @@ void LoggingServerI::configure(std::auto_ptr<ChainedLogOut> out,
ServerConfigurationListenerPrx configurationListener,
Ice::PropertiesPtr props)
{
- this->out = out;
- this->configurationListener = configurationListener;
+ this->mOut = out;
+ this->mConfigurationListener = configurationListener;
Ice::PropertyDict myProps = props->getPropertiesForPrefix(
LoggingPropertyPrefix);
diff --git a/server/src/LoggingServer.h b/server/src/LoggingServer.h
index 5f2ea2a..1a17190 100644
--- a/server/src/LoggingServer.h
+++ b/server/src/LoggingServer.h
@@ -28,27 +28,27 @@ class SourceNode
{
public:
SourceNode() :
- level(Debug)
+ mLogLevel(Debug)
{
}
bool isEnabledFor(Level level) const
{
- return this->level <= level;
+ return this->mLogLevel <= level;
}
- void setLevel(Level level)
+ void setLogLevel(Level level)
{
- this->level = level;
+ this->mLogLevel = level;
}
- Level getLevel() const
+ Level getLogLevel() const
{
- return level;
+ return mLogLevel;
}
private:
- Level level;
+ Level mLogLevel;
};
class LoggingServerI : public LoggingServer
@@ -86,12 +86,12 @@ private:
*/
static bool isSubpathOf(std::string const &path, std::string const &subpath);
- IceUtil::Mutex sourcesMutex;
- Sources sources;
+ IceUtil::Mutex mSourcesMutex;
+ Sources mSources;
- ServerConfigurationListenerPrx configurationListener;
+ ServerConfigurationListenerPrx mConfigurationListener;
- std::auto_ptr<ChainedLogOut> out;
+ std::auto_ptr<ChainedLogOut> mOut;
};
} // Logging
diff --git a/server/src/OstreamChainedLogOut.cpp b/server/src/OstreamChainedLogOut.cpp
index 4852865..5b9eff2 100644
--- a/server/src/OstreamChainedLogOut.cpp
+++ b/server/src/OstreamChainedLogOut.cpp
@@ -15,6 +15,6 @@ using namespace AsteriskSCF::System::Logging;
void OstreamChainedLogOut::myLogs(std::string const &name, Level logLevel,
std::string const &message)
{
- IceUtil::Mutex::Lock lock(outMutex);
- logs(out, name, logLevel, message);
+ IceUtil::Mutex::Lock lock(mOutMutex);
+ logs(mOut, name, logLevel, message);
}
diff --git a/server/src/OstreamChainedLogOut.h b/server/src/OstreamChainedLogOut.h
index 8b422d2..caf5847 100644
--- a/server/src/OstreamChainedLogOut.h
+++ b/server/src/OstreamChainedLogOut.h
@@ -25,11 +25,11 @@ class OstreamChainedLogOut : public ChainedLogOut
{
public:
OstreamChainedLogOut(std::ostream &out) :
- ChainedLogOut(), out(out)
+ ChainedLogOut(), mOut(out)
{
}
OstreamChainedLogOut(std::ostream &out, std::auto_ptr<ChainedLogOut> next) :
- ChainedLogOut(next), out(out)
+ ChainedLogOut(next), mOut(out)
{
}
@@ -38,8 +38,8 @@ protected:
std::string const &message);
private:
- IceUtil::Mutex outMutex;
- std::ostream &out;
+ IceUtil::Mutex mOutMutex;
+ std::ostream &mOut;
};
} // Logging
diff --git a/server/src/main.cpp b/server/src/main.cpp
index 60664ec..3a8dc95 100644
--- a/server/src/main.cpp
+++ b/server/src/main.cpp
@@ -30,8 +30,8 @@ protected:
bool start(int argc, char *argv[], int &status);
bool stop();
private:
- Ice::ObjectAdapterPtr adapter;
- ServiceManagementPrx serviceManagement;
+ Ice::ObjectAdapterPtr mAdapter;
+ ServiceManagementPrx mServiceManagement;
void registerWithServiceLocator(LoggingServerPrx serverProxy);
void setupDefaultProperties();
@@ -53,11 +53,11 @@ void LoggingServerDaemon::registerWithServiceLocator(
ServiceLocatorManagementPrx management =
ServiceLocatorManagementPrx::checkedCast(
communicator()->stringToProxy(locatorManagementProxyString));
- serviceManagement = management->addService(serverProxy,
+ mServiceManagement = management->addService(serverProxy,
LoggingServerGuid);
ServiceLocatorParamsPtr params = new ServiceLocatorParams(
LoggingServerCategory);
- serviceManagement->addLocatorParams(params, "");
+ mServiceManagement->addLocatorParams(params, "");
}
}
catch (std::exception const &e)
@@ -87,7 +87,7 @@ bool LoggingServerDaemon::start(int argc, char *argv[], int &status)
{
setupDefaultProperties();
- adapter = communicator()->createObjectAdapter(AdapterName);
+ mAdapter = communicator()->createObjectAdapter(AdapterName);
ServerConfigurationListenerPrx configurationListener;
@@ -145,8 +145,8 @@ bool LoggingServerDaemon::start(int argc, char *argv[], int &status)
communicator()->getProperties());
LoggingServerPrx serverProxy = LoggingServerPrx::uncheckedCast(
- adapter->addWithUUID(server));
- adapter->activate();
+ mAdapter->addWithUUID(server));
+ mAdapter->activate();
std::cout << serverProxy->ice_toString() << '\n';
registerWithServiceLocator(serverProxy);
@@ -157,9 +157,9 @@ bool LoggingServerDaemon::start(int argc, char *argv[], int &status)
bool LoggingServerDaemon::stop()
{
- if (serviceManagement)
+ if (mServiceManagement)
{
- serviceManagement->unregister();
+ mServiceManagement->unregister();
}
return true;
}
commit ad8de890cfb693dbc7ba6dddc95ce3bf29ea81fa
Author: David M. Lee <dlee at digium.com>
Date: Fri Oct 1 13:49:45 2010 -0500
Hungarian-ise the client.
diff --git a/client/src/IceConfigurator.cpp b/client/src/IceConfigurator.cpp
index 50aff27..595d726 100644
--- a/client/src/IceConfigurator.cpp
+++ b/client/src/IceConfigurator.cpp
@@ -35,7 +35,7 @@ void IceConfigurator::configured(Configuration const &logConfiguration,
void IceConfigurator::configured(Configuration const &logConfiguration)
{
- std::vector<std::string> oldConfig = factory.getLoggerNames();
+ std::vector<std::string> oldConfig = mFactory.getLoggerNames();
SourceConfigurationSeq newConfig = logConfiguration.sourceSettings;
// processing is easier if lists are sorted
@@ -72,21 +72,21 @@ void IceConfigurator::configured(Configuration const &logConfiguration)
if (cmp < 0)
{
// apply a new config
- factory.getLogger(newConfigIter->name).setLevel(
+ mFactory.getLogger(newConfigIter->name).setLevel(
newConfigIter->logLevel);
++newConfigIter;
}
else if (cmp == 0)
{
// change an old config
- factory.getLogger(newConfigIter->name).setLevel(
+ mFactory.getLogger(newConfigIter->name).setLevel(
newConfigIter->logLevel);
++newConfigIter;
++oldConfigIter;
}
else // if (cmp > 0)
{
- factory.getLogger(*oldConfigIter).unsetLevel();
+ mFactory.getLogger(*oldConfigIter).unsetLevel();
++oldConfigIter;
}
}
diff --git a/client/src/IceConfigurator.h b/client/src/IceConfigurator.h
index 48bb9e5..267ea96 100644
--- a/client/src/IceConfigurator.h
+++ b/client/src/IceConfigurator.h
@@ -25,14 +25,14 @@ class IceConfigurator : public ServerConfigurationListener
{
public:
IceConfigurator(LoggerFactory &factory) :
- factory(factory)
+ mFactory(factory)
{
}
HYDRA_ICEBOX_EXPORT void configured(Configuration const &logConfiguration, Ice::Current const &);
HYDRA_ICEBOX_EXPORT void configured(Configuration const &logConfiguration);
private:
- LoggerFactory &factory;
+ LoggerFactory &mFactory;
};
typedef IceUtil::Handle<IceConfigurator> IceConfiguratorPtr;
diff --git a/client/src/IceLogger.cpp b/client/src/IceLogger.cpp
index a2c926f..a6a8f30 100644
--- a/client/src/IceLogger.cpp
+++ b/client/src/IceLogger.cpp
@@ -22,9 +22,9 @@ void IceLogger::logs(std::string const &name, Level logLevel,
bool logged = false;
try
{
- if (server)
+ if (mServer)
{
- server->logs(name, logLevel, message);
+ mServer->logs(name, logLevel, message);
logged = true;
}
}
@@ -46,35 +46,35 @@ void IceLogger::logs(std::string const &name, Level logLevel,
ConfiguredIceLogger::ConfiguredIceLogger(LoggingServerPrx server)
{
- logger.setServer(server);
+ mLogger.setServer(server);
}
ConfiguredIceLogger::ConfiguredIceLogger(ServiceLocatorPrx locator) :
- locator(locator)
+ mLocator(locator)
{
//updateLoggerFromServiceLocator();
}
void ConfiguredIceLogger::updateLoggerFromServiceLocator()
{
- if (locator)
+ if (mLocator)
{
try
{
ServiceLocatorParamsPtr loggingServerParams =
new ServiceLocatorParams();
- Ice::ObjectPrx serverObject = locator->locate(loggingServerParams);
+ Ice::ObjectPrx serverObject = mLocator->locate(loggingServerParams);
if (serverObject)
{
LoggingServerPrx server = LoggingServerPrx::checkedCast(
serverObject);
- logger.setServer(server);
+ mLogger.setServer(server);
}
}
catch (Core::Discovery::V1::ServiceNotFound const &)
{
// couldn't find the service;
- logger.setServer(LoggingServerPrx());
+ mLogger.setServer(LoggingServerPrx());
}
}
}
diff --git a/client/src/IceLogger.h b/client/src/IceLogger.h
index 8dc002b..63e4084 100644
--- a/client/src/IceLogger.h
+++ b/client/src/IceLogger.h
@@ -30,11 +30,11 @@ public:
void logs(std::string const &name, Level logLevel,
std::string const &message);
- LoggingServerPrx getServer() const { return server; }
- void setServer(LoggingServerPrx server) { this->server = server; }
+ LoggingServerPrx getServer() const { return mServer; }
+ void setServer(LoggingServerPrx server) { this->mServer = server; }
private:
- LoggingServerPrx server;
+ LoggingServerPrx mServer;
};
/**
@@ -57,7 +57,7 @@ public:
*/
ConfiguredIceLogger(Core::Discovery::V1::ServiceLocatorPrx locator);
- LogOut &getLogger() { return logger; }
+ LogOut &getLogger() { return mLogger; }
void updateLoggerFromServiceLocator();
@@ -69,8 +69,8 @@ public:
void serviceUnsuspended(std::string const &guid, Ice::Current const &);
private:
- IceLogger logger;
- Core::Discovery::V1::ServiceLocatorPrx locator;
+ IceLogger mLogger;
+ Core::Discovery::V1::ServiceLocatorPrx mLocator;
};
typedef IceUtil::Handle<ConfiguredIceLogger> ConfiguredIceLoggerPtr;
diff --git a/client/src/Logger.cpp b/client/src/Logger.cpp
index 41a420c..674bad1 100644
--- a/client/src/Logger.cpp
+++ b/client/src/Logger.cpp
@@ -16,19 +16,19 @@ using namespace AsteriskSCF::System::Logging;
const int MESSAGE_SIZE = 120;
LogBuf::LogBuf(LogOut &out, std::string const &name, Level logLevel) :
- out(out), name(name), logLevel(logLevel)
+ mOut(out), nName(name), mLogLevel(logLevel)
{
}
LogBuf::LogBuf(LogBuf const &orig) :
- out(orig.out), name(orig.name), logLevel(orig.logLevel)
+ mOut(orig.mOut), nName(orig.nName), mLogLevel(orig.mLogLevel)
{
- buffer.str(orig.buffer.str());
+ mBuffer.str(orig.mBuffer.str());
}
LogBuf::~LogBuf()
{
- if (!buffer.str().empty())
+ if (!mBuffer.str().empty())
{
sendBuffer();
}
@@ -41,37 +41,37 @@ int LogBuf::overflow(int c)
sendBuffer();
return c;
}
- return buffer.sputc(c);
+ return mBuffer.sputc(c);
}
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 = buffer.str();
- buffer.str("");
+ std::string const &message = mBuffer.str();
+ mBuffer.str("");
// send
- out.logs(name, logLevel, message);
+ mOut.logs(nName, mLogLevel, message);
}
Logger::Logger(std::string const &name, LogOut &out, Level logLevel) :
- parent(0), name(name), out(&out), logLevel(logLevel), inheritedLevel(false)
+ mParent(0), mName(name), mOut(&out), mLogLevel(logLevel), mInheritedLevel(false)
{
}
Logger::Logger(Logger const &parent, std::string const &name) :
- parent(&parent), name(name), out(parent.out), logLevel(Off), inheritedLevel(
+ mParent(&parent), mName(name), mOut(parent.mOut), mLogLevel(Off), mInheritedLevel(
true)
{
// our name must begin w/ parent's name
- assert(name.find(parent.name) == 0);
+ assert(name.find(parent.mName) == 0);
}
Logger::~Logger()
{
- IceUtil::Mutex::Lock childLock(childrenMutex);
- for (std::map<std::string, Logger *>::iterator i = children.begin();
- i != children.end();
+ IceUtil::Mutex::Lock childLock(mChildrenMutex);
+ for (std::map<std::string, Logger *>::iterator i = mChildren.begin();
+ i != mChildren.end();
++i)
{
delete i->second;
@@ -81,14 +81,14 @@ Logger::~Logger()
CondStream Logger::operator()(Level level) const
{
- return CondStream(*out, name, level, isEnabledFor(level));
+ return CondStream(*mOut, mName, level, isEnabledFor(level));
}
void Logger::logs(Level level, std::string const &message) const
{
if (isEnabledFor(level))
{
- out->logs(name, level, message);
+ mOut->logs(mName, level, message);
}
}
@@ -108,16 +108,16 @@ void Logger::vlogf(Level level, char const *fmt, va_list ap) const
vsnprintf(message, sizeof(message), fmt, ap);
// snprintf may not actually null terminate, so just in case
message[MESSAGE_SIZE - 1] = '\0';
- out->logs(name, level, message);
+ mOut->logs(mName, level, message);
}
}
void Logger::setOutput(LogOut &out)
{
- this->out = &out;
- IceUtil::Mutex::Lock childLock(childrenMutex);
- for (std::map<std::string, Logger *>::const_iterator i = children.begin(); i
- != children.end(); ++i)
+ this->mOut = &out;
+ IceUtil::Mutex::Lock childLock(mChildrenMutex);
+ for (std::map<std::string, Logger *>::const_iterator i = mChildren.begin(); i
+ != mChildren.end(); ++i)
{
i->second->setOutput(out);
}
@@ -126,34 +126,34 @@ void Logger::setOutput(LogOut &out)
void Logger::setLevel(Level logLevel)
{
- this->logLevel = logLevel;
- inheritedLevel = false;
+ this->mLogLevel = logLevel;
+ mInheritedLevel = false;
}
void Logger::unsetLevel()
{
- inheritedLevel = true;
- logLevel = Off;
+ mInheritedLevel = true;
+ mLogLevel = Off;
}
Level Logger::getEffectiveLevel() const
{
// if our level is unset, inherit level from our parent.
- if (inheritedLevel == true && parent != 0)
+ if (mInheritedLevel == true && mParent != 0)
{
- return parent->getEffectiveLevel();
+ return mParent->getEffectiveLevel();
}
else
{
- return logLevel;
+ return mLogLevel;
}
}
Logger &Logger::getChild(std::string const &childName)
{
// ref to ptr allows us to update the map in-place
- IceUtil::Mutex::Lock childLock(childrenMutex);
- Logger *&child = children[childName];
+ IceUtil::Mutex::Lock childLock(mChildrenMutex);
+ Logger *&child = mChildren[childName];
if (child == 0)
{
std::string fullName = getName().empty() ? childName : getName() + "."
@@ -166,9 +166,9 @@ Logger &Logger::getChild(std::string const &childName)
std::vector<Logger const *> Logger::getChildren() const
{
std::vector<Logger const *> r;
- IceUtil::Mutex::Lock childLock(childrenMutex);
- for (std::map<std::string, Logger *>::const_iterator i = children.begin();
- i != children.end();
+ IceUtil::Mutex::Lock childLock(mChildrenMutex);
+ for (std::map<std::string, Logger *>::const_iterator i = mChildren.begin();
+ i != mChildren.end();
++i)
{
r.push_back(i->second);
diff --git a/client/src/LoggerFactory.cpp b/client/src/LoggerFactory.cpp
index 30a87cf..c14932b 100644
--- a/client/src/LoggerFactory.cpp
+++ b/client/src/LoggerFactory.cpp
@@ -43,7 +43,7 @@ LoggerFactory &AsteriskSCF::System::Logging::getLoggerFactory()
}
LoggerFactory::LoggerFactory(LogOut &out) :
- root("", out)
+ mRoot("", out)
{
}
@@ -57,7 +57,7 @@ Logger &LoggerFactory::getLogger(std::string const &name)
split(path, name, std::bind1st(std::equal_to<char>(), '.'));
}
- Logger *logger = &root;
+ Logger *logger = &mRoot;
for (std::vector<std::string>::iterator i = path.begin(); i != path.end(); ++i)
{
logger = &logger->getChild(*i);
@@ -69,7 +69,7 @@ Logger &LoggerFactory::getLogger(std::string const &name)
std::vector<std::string> LoggerFactory::getLoggerNames() const
{
std::vector<std::string> r;
- accumulateLoggerNames(root, r);
+ accumulateLoggerNames(mRoot, r);
return r;
}
@@ -88,5 +88,5 @@ void LoggerFactory::accumulateLoggerNames(Logger const &logger, std::vector<
void LoggerFactory::setLogOutput(LogOut &out)
{
- root.setOutput(out);
+ mRoot.setOutput(out);
}
diff --git a/client/src/OstreamLogger.cpp b/client/src/OstreamLogger.cpp
index 3b64467..90aa2e2 100644
--- a/client/src/OstreamLogger.cpp
+++ b/client/src/OstreamLogger.cpp
@@ -17,7 +17,7 @@ class OstreamLogger : public LogOut
{
public:
OstreamLogger(std::ostream &out) :
- out(out)
+ mOut(out)
{
}
@@ -25,11 +25,11 @@ public:
void logs(std::string const &name, Level logLevel,
std::string const &message)
{
- out << name << ":" << logLevel << ":" << message << '\n';
+ mOut << name << ":" << logLevel << ":" << message << '\n';
}
private:
- std::ostream &out;
+ std::ostream &mOut;
};
}
diff --git a/client/src/logger.h b/client/src/logger.h
index 05f6b5b..5e0b458 100644
--- a/client/src/logger.h
+++ b/client/src/logger.h
@@ -45,10 +45,10 @@ protected:
int overflow(int c);
private:
- std::stringbuf buffer;
- LogOut &out;
- const std::string name;
- const Level logLevel;
+ std::stringbuf mBuffer;
+ LogOut &mOut;
+ const std::string nName;
+ const Level mLogLevel;
/**
* Sends the current buffer to out and clears it.
@@ -65,7 +65,7 @@ class CondStream
public:
CondStream(LogOut &out, std::string const &name, Level logLevel,
bool enabled) :
- buf(out, name, logLevel), stream(&buf), enabled(enabled)
+ mBuf(out, name, logLevel), mStream(&mBuf), mEnabled(enabled)
{
}
@@ -74,7 +74,7 @@ public:
* @param orig Original.
*/
CondStream(CondStream const &orig) :
- buf(orig.buf), stream(&buf), enabled(orig.enabled)
+ mBuf(orig.mBuf), mStream(&mBuf), mEnabled(orig.mEnabled)
{
}
@@ -96,32 +96,32 @@ private:
/**
* streambuffer for writing characters.
*/
- LogBuf buf;
+ LogBuf mBuf;
/**
* Ostream for processing output.
*/
- std::ostream stream;
+ std::ostream mStream;
/**
* If false, operator<<() does nothing.
*/
- bool enabled;
+ bool mEnabled;
};
template<typename T>
inline CondStream &CondStream::operator<<(T const &val)
{
- if (enabled)
+ if (mEnabled)
{
- stream << val;
+ mStream << val;
}
return *this;
}
inline CondStream &CondStream::operator<<(std::ostream& (*pf)(std::ostream&))
{
- if (enabled)
+ if (mEnabled)
{
- stream << pf;
+ mStream << pf;
}
return *this;
}
@@ -180,7 +180,7 @@ public:
Logger const *getParent() const
{
- return parent;
+ return mParent;
}
HYDRA_ICEBOX_EXPORT Logger &getChild(std::string const &childName);
@@ -188,12 +188,12 @@ public:
HYDRA_ICEBOX_EXPORT std::string const &getName() const
{
- return name;
+ return mName;
}
HYDRA_ICEBOX_EXPORT LogOut &getOutput() const
{
- return *out;
+ return *mOut;
}
HYDRA_ICEBOX_EXPORT void setOutput(LogOut &out);
@@ -222,34 +222,34 @@ private:
/**
* Mutex for access to the children field.
*/
- IceUtil::Mutex childrenMutex;
+ IceUtil::Mutex mChildrenMutex;
/**
* Parent pointer. We cannot change which parent we have, nor can we change
* our parent.
*/
- Logger const * const parent;
+ Logger const * const mParent;
/**
* Map of children. The key is the next final node in that child's name.
*/
- std::map<std::string, Logger *> children;
+ std::map<std::string, Logger *> mChildren;
/**
* Name of this logger, in dotted-notation.
*/
- const std::string name;
+ const std::string mName;
/**
* Output for log messages.
*/
- LogOut *out;
+ LogOut *mOut;
/**
* Current level of this Logger. Only applicable if inheritedLevel == false.
*/
- Level logLevel;
+ Level mLogLevel;
/**
* If true, then our effectiveLevel == parent->effectiveLevel.
*/
- bool inheritedLevel;
+ bool mInheritedLevel;
};
/**
@@ -279,7 +279,7 @@ public:
HYDRA_ICEBOX_EXPORT void setLogOutput(LogOut &out);
private:
- Logger root;
+ Logger mRoot;
static void accumulateLoggerNames(Logger const &logger, std::vector<std::string> &out);
};
-----------------------------------------------------------------------
--
asterisk-scf/integration/logger.git
More information about the asterisk-scf-commits
mailing list