[asterisk-scf-commits] asterisk-scf/integration/bridging.git branch "master" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Tue Oct 5 13:56:18 CDT 2010
branch "master" has been updated
via f05bd336a9a66fe8a5362d35b85c06092dfaf494 (commit)
via b7a8d362bdfab840bcf6d9f2bb97c8a9a3462ea6 (commit)
from b02dd548279d4f85369e943c4ea836abf9e14a78 (commit)
Summary of changes:
.gitmodules | 3 ++
CMakeLists.txt | 3 ++
cmake | 2 +-
logger | 1 +
slice | 2 +-
src/BridgeImpl.cpp | 38 +++++++++++++++++++------------
src/BridgeImpl.h | 2 -
src/BridgeManagerImpl.cpp | 38 +++++++++++++++++++------------
src/BridgeManagerImpl.h | 2 -
src/CMakeLists.txt | 8 ++++++
src/Logger.h | 53 ---------------------------------------------
src/Service.cpp | 21 +++++++++++++----
test/CMakeLists.txt | 10 ++++++++
13 files changed, 89 insertions(+), 94 deletions(-)
create mode 160000 logger
delete mode 100644 src/Logger.h
- Log -----------------------------------------------------------------
commit f05bd336a9a66fe8a5362d35b85c06092dfaf494
Author: David M. Lee <dlee at digium.com>
Date: Tue Oct 5 13:41:37 2010 -0500
Got rid of Logger placeholder.
diff --git a/src/BridgeImpl.cpp b/src/BridgeImpl.cpp
index 1069945..c6b6538 100644
--- a/src/BridgeImpl.cpp
+++ b/src/BridgeImpl.cpp
@@ -6,6 +6,7 @@
* All rights reserved.
*/
#include "BridgeImpl.h"
+#include "logger.h"
#include <System/Component/ComponentServiceIf.h>
#include <SessionCommunications/SessionCommunicationsIf.h>
#include <Ice/Ice.h>
@@ -13,15 +14,18 @@
#include <algorithm>
#include <boost/thread/locks.hpp>
+using namespace AsteriskSCF::System::Logging;
+
+namespace
+{
+Logger &lg = getLoggerFactory().getLogger("AsteriskSCF.BridgeService");
+}
+
//
// Compiled in constants.
// TODO: Replace with configuration!
//
-AsteriskSCF::System::Logging::Logger &AsteriskSCF::BridgeService::lg =
- AsteriskSCF::System::Logging::getLoggerFactory().getLogger(
- "AsteriskSCF.BridgeService");
-
static const std::string TopicPrefix("AsteriskSCF.Bridge.");
//
@@ -369,10 +373,10 @@ void AsteriskSCF::BridgeService::BridgeImpl::removeSessions(const AsteriskSCF::S
AsteriskSCF::SessionCommunications::V1::SessionSeq AsteriskSCF::BridgeService::BridgeImpl::listSessions(const Ice::Current& current)
{
- mLogger.getTraceStream() << __FUNCTION__ << ":" << current.adapter->getCommunicator()->identityToString(current.id) << std::endl;
+ lg(Debug) << __FUNCTION__ << ":" << current.adapter->getCommunicator()->identityToString(current.id) ;
boost::shared_lock<boost::shared_mutex> lock(mLock);
statePreCheck();
- mLogger.getDebugStream() << __FUNCTION__ << ": working with " << mSessions.size() << " sessions." << std::endl;
+ lg(Debug) << __FUNCTION__ << ": working with " << mSessions.size() << " sessions." ;
AsteriskSCF::SessionCommunications::V1::SessionSeq result;
for(std::vector<AsteriskSCF::BridgeService::BridgeImpl::BridgeSession>::const_iterator i = mSessions.begin(); i != mSessions.end(); ++i)
{
@@ -387,16 +391,16 @@ void AsteriskSCF::BridgeService::BridgeImpl::shutdown(const Ice::Current& curren
// When shutting down, the bridge makes a copy of its current state and unlocks, proceeding with
// no other internal locks.
//
- mLogger.getTraceStream() << __FUNCTION__ << ":" << current.adapter->getCommunicator()->identityToString(current.id) << std::endl;
+ lg(Debug) << __FUNCTION__ << ":" << current.adapter->getCommunicator()->identityToString(current.id) ;
boost::unique_lock<boost::shared_mutex> lock(mLock);
if(mState == ShuttingDown)
{
- mLogger.getDebugStream() << __FUNCTION__ << ": called when shutting down." << std::endl;
+ lg(Debug) << __FUNCTION__ << ": called when shutting down." ;
return;
}
if(mState == Destroyed)
{
- mLogger.getDebugStream() << __FUNCTION__ << ": called when destroyed." << std::endl;
+ lg(Debug) << __FUNCTION__ << ": called when destroyed." ;
throw Ice::ObjectNotExistException(__FILE__, __LINE__);
}
mState = ShuttingDown;
@@ -412,7 +416,7 @@ void AsteriskSCF::BridgeService::BridgeImpl::shutdown(const Ice::Current& curren
AsteriskSCF::BridgeService::ShutdownImpl(mSessionListenerPrx, new AsteriskSCF::SessionCommunications::V1::ResponseCode));
}
- mLogger.getInfoStream() << current.adapter->getCommunicator()->identityToString(current.id) << ": is shutdown." << std::endl;
+ lg(Info) << current.adapter->getCommunicator()->identityToString(current.id) << ": is shutdown." ;
mListeners->stopped();
}
@@ -431,20 +435,20 @@ void AsteriskSCF::BridgeService::BridgeImpl::removeListener(const AsteriskSCF::S
void AsteriskSCF::BridgeService::BridgeImpl::destroy(const Ice::Current& current)
{
{
- mLogger.getTraceStream() << __FUNCTION__ << ":" << current.adapter->getCommunicator()->identityToString(current.id) << std::endl;
+ lg(Debug) << __FUNCTION__ << ":" << current.adapter->getCommunicator()->identityToString(current.id) ;
boost::unique_lock<boost::shared_mutex> lock(mLock);
if(mState == ShuttingDown)
{
- mLogger.getDebugStream() << __FUNCTION__ << ": called when shutting down." << std::endl;
+ lg(Debug) << __FUNCTION__ << ": called when shutting down." ;
throw AsteriskSCF::System::Component::V1::ShuttingDown();
}
if(mState == Destroyed)
{
- mLogger.getDebugStream() << __FUNCTION__ << ": called when destroyed." << std::endl;
+ lg(Debug) << __FUNCTION__ << ": called when destroyed." ;
throw Ice::ObjectNotExistException(__FILE__, __LINE__);
}
mState = Destroyed;
- mLogger.getInfoStream() << current.adapter->getCommunicator()->identityToString(current.id) << ": is now destroyed." << std::endl;
+ lg(Info) << current.adapter->getCommunicator()->identityToString(current.id) << ": is now destroyed." ;
mListeners->stopped();
}
@@ -457,13 +461,13 @@ void AsteriskSCF::BridgeService::BridgeImpl::destroy(const Ice::Current& current
bool AsteriskSCF::BridgeService::BridgeImpl::destroyed()
{
boost::shared_lock<boost::shared_mutex> lock(mLock);
- mLogger.getDebugStream() << __FUNCTION__ << ": " << (mState == Destroyed ? "yes, I am destroyed." : "no, I am not destroyed") << std::endl;
+ lg(Debug) << __FUNCTION__ << ": " << (mState == Destroyed ? "yes, I am destroyed." : "no, I am not destroyed") ;
return mState == Destroyed;
}
void AsteriskSCF::BridgeService::BridgeImpl::sessionConnected(const AsteriskSCF::SessionCommunications::V1::SessionPrx& session)
{
- mLogger.getDebugStream() << __FUNCTION__ << ": session connected " << session->ice_toString() << std::endl;
+ lg(Debug) << __FUNCTION__ << ": session connected " << session->ice_toString() ;
boost::unique_lock<boost::shared_mutex> lock(mLock);
std::vector<BridgeSession>::iterator i = find_if(mSessions.begin(), mSessions.end(), AsteriskSCF::BridgeService::FindImpl(session));
if(i != mSessions.end())
@@ -475,7 +479,7 @@ void AsteriskSCF::BridgeService::BridgeImpl::sessionConnected(const AsteriskSCF:
size_t AsteriskSCF::BridgeService::BridgeImpl::sessionStopped(const AsteriskSCF::SessionCommunications::V1::SessionPrx& session,
const AsteriskSCF::SessionCommunications::V1::ResponseCodePtr& response)
{
- mLogger.getDebugStream() << __FUNCTION__ << ": session terminated from " << session->ice_toString() << std::endl;
+ lg(Debug) << __FUNCTION__ << ": session terminated from " << session->ice_toString() ;
session->removeListener(mSessionListenerPrx);
boost::unique_lock<boost::shared_mutex> lock(mLock);
@@ -496,12 +500,12 @@ void AsteriskSCF::BridgeService::BridgeImpl::statePreCheck()
{
if(mState == ShuttingDown)
{
- mLogger.getDebugStream() << __FUNCTION__ << ": called when shutting down." << std::endl;
+ lg(Debug) << __FUNCTION__ << ": called when shutting down." ;
throw AsteriskSCF::System::Component::V1::ShuttingDown();
}
if(mState == Destroyed)
{
- mLogger.getDebugStream() << __FUNCTION__ << ": called when destroyed." << std::endl;
+ lg(Debug) << __FUNCTION__ << ": called when destroyed." ;
throw Ice::ObjectNotExistException(__FILE__, __LINE__);
}
}
diff --git a/src/BridgeImpl.h b/src/BridgeImpl.h
index daf94bd..5122660 100644
--- a/src/BridgeImpl.h
+++ b/src/BridgeImpl.h
@@ -11,7 +11,6 @@
#include <SessionCommunications/SessionCommunicationsIf.h>
#include <boost/thread/shared_mutex.hpp>
#include <vector>
-#include "BridgeLogger.h"
#include "MediaSplicer.h"
#include "BridgeListenerMgr.h"
@@ -81,7 +80,6 @@ namespace BridgeService
std::vector<BridgeSession> mSessions;
MediaSplicer mSplicer;
- Logger mLogger;
const std::string mName;
Ice::ObjectAdapterPtr mObjAdapter;
diff --git a/src/BridgeLogger.h b/src/BridgeLogger.h
deleted file mode 100644
index 6116aad..0000000
--- a/src/BridgeLogger.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Asterisk Scalable Communications Framework
- *
- * Copyright (C) 2010 -- Digium, Inc.
- *
- * All rights reserved.
- */
-#pragma once
-
-#include "logger.h"
-
-namespace AsteriskSCF
-{
-namespace BridgeService
-{
- extern System::Logging::Logger ≶
- //
- // Place holder log stream holder.
- // TODO: now that we have a really logger class, we should replace this
- // placeholder and remove this class..
- //
- class Logger
- {
- public:
- System::Logging::CondStream getTraceStream()
- {
- return lg(System::Logging::Debug); // Logger doesn't go as low as trace
- }
-
- System::Logging::CondStream getErrorStream()
- {
- return lg(System::Logging::Error);
- }
-
- System::Logging::CondStream getDebugStream()
- {
- return lg(System::Logging::Debug);
- }
-
- bool debugTracing() { return lg.isEnabledFor(System::Logging::Debug); }
-
- System::Logging::CondStream getInfoStream()
- {
- return lg(System::Logging::Info);
- }
- };
-} // End of namespace BridgeImpl
-} // End of namespace AsteriskSCF
diff --git a/src/BridgeManagerImpl.cpp b/src/BridgeManagerImpl.cpp
index 270ec95..3b8e38e 100644
--- a/src/BridgeManagerImpl.cpp
+++ b/src/BridgeManagerImpl.cpp
@@ -11,6 +11,14 @@
#include <boost/thread/locks.hpp>
#include "BridgeListenerMgr.h"
#include "BridgeManagerListenerMgr.h"
+#include "logger.h"
+
+using namespace AsteriskSCF::System::Logging;
+
+namespace
+{
+Logger &lg = getLoggerFactory().getLogger("AsteriskSCF.BridgeService");
+}
//
// Compiled in constants.
@@ -54,7 +62,7 @@ AsteriskSCF::BridgeService::BridgeManagerImpl::BridgeManagerImpl(
mSuspended(false),
mAdapter(adapter)
{
- mLogger.getInfoStream() << "Created AsteriskSCF Session-Oriented Bridge Manager." << std::endl;
+ lg(Info) << "Created AsteriskSCF Session-Oriented Bridge Manager." ;
}
void AsteriskSCF::BridgeService::BridgeManagerImpl::setPublishProxy(const AsteriskSCF::SessionCommunications::Bridging::V1::BridgeManagerPrx& prx)
@@ -76,17 +84,17 @@ AsteriskSCF::SessionCommunications::Bridging::V1::BridgePrx AsteriskSCF::BridgeS
const AsteriskSCF::SessionCommunications::Bridging::V1::BridgeListenerPrx& listener,
const Ice::Current& current)
{
- mLogger.getTraceStream() << __FUNCTION__ << ":" << current.adapter->getCommunicator()->identityToString(current.id) << std::endl;
+ lg(Debug) << __FUNCTION__ << ":" << current.adapter->getCommunicator()->identityToString(current.id) ;
boost::unique_lock<boost::shared_mutex> lock(mLock);
if(mShuttingDown)
{
- mLogger.getDebugStream() << __FUNCTION__ << ": called when shutting down." << std::endl;
+ lg(Debug) << __FUNCTION__ << ": called when shutting down." ;
throw AsteriskSCF::System::Component::V1::ShuttingDown();
}
if(mSuspended)
{
- mLogger.getDebugStream() << __FUNCTION__ << ": called when suspended." << std::endl;
+ lg(Debug) << __FUNCTION__ << ": called when suspended." ;
throw AsteriskSCF::System::Component::V1::Suspended();
}
reap();
@@ -100,7 +108,7 @@ AsteriskSCF::SessionCommunications::Bridging::V1::BridgePrx AsteriskSCF::BridgeS
AsteriskSCF::BridgeService::BridgeImplPtr bridge = new AsteriskSCF::BridgeService::BridgeImpl(mAdapter, listener, mgr);
Ice::ObjectPrx obj = mAdapter->add(bridge, id);
- mLogger.getInfoStream() << current.adapter->getCommunicator()->identityToString(current.id) << ": creating new bridge " << obj->ice_toString() << "." << std::endl;
+ lg(Info) << current.adapter->getCommunicator()->identityToString(current.id) << ": creating new bridge " << obj->ice_toString() << "." ;
BridgeInfo info;
info.servant = bridge;
info.proxy = AsteriskSCF::SessionCommunications::Bridging::V1::BridgePrx::uncheckedCast(obj);
@@ -123,12 +131,12 @@ void AsteriskSCF::BridgeService::BridgeManagerImpl::addListener(const SessionCom
boost::unique_lock<boost::shared_mutex> lock(mLock);
if(mShuttingDown)
{
- mLogger.getDebugStream() << __FUNCTION__ << ": called when shutting down." << std::endl;
+ lg(Debug) << __FUNCTION__ << ": called when shutting down." ;
throw AsteriskSCF::System::Component::V1::ShuttingDown();
}
if(mSuspended)
{
- mLogger.getDebugStream() << __FUNCTION__ << ": called when suspended." << std::endl;
+ lg(Debug) << __FUNCTION__ << ": called when suspended." ;
throw AsteriskSCF::System::Component::V1::Suspended();
}
if(!mListeners)
@@ -144,12 +152,12 @@ void AsteriskSCF::BridgeService::BridgeManagerImpl::removeListener(const Session
boost::unique_lock<boost::shared_mutex> lock(mLock);
if(mShuttingDown)
{
- mLogger.getDebugStream() << __FUNCTION__ << ": called when shutting down." << std::endl;
+ lg(Debug) << __FUNCTION__ << ": called when shutting down." ;
throw AsteriskSCF::System::Component::V1::ShuttingDown();
}
if(mSuspended)
{
- mLogger.getDebugStream() << __FUNCTION__ << ": called when suspended." << std::endl;
+ lg(Debug) << __FUNCTION__ << ": called when suspended." ;
throw AsteriskSCF::System::Component::V1::Suspended();
}
if(!mListeners)
@@ -174,23 +182,23 @@ AsteriskSCF::BridgeService::BridgeManagerImpl::listBridges(const Ice::Current&)
void AsteriskSCF::BridgeService::BridgeManagerImpl::shutdown(const Ice::Current& current)
{
- mLogger.getTraceStream() << __FUNCTION__ << ":" << current.adapter->getCommunicator()->identityToString(current.id) << std::endl;
+ lg(Debug) << __FUNCTION__ << ":" << current.adapter->getCommunicator()->identityToString(current.id) ;
boost::unique_lock<boost::shared_mutex> lock(mLock);
if(mShuttingDown)
{
- mLogger.getDebugStream() << __FUNCTION__ << ": called when shutting down." << std::endl;
+ lg(Debug) << __FUNCTION__ << ": called when shutting down." ;
return;
}
if(mSuspended)
{
- mLogger.getDebugStream() << __FUNCTION__ << ": called when suspended." << std::endl;
+ lg(Debug) << __FUNCTION__ << ": called when suspended." ;
throw AsteriskSCF::System::Component::V1::Suspended();
}
if(mListeners)
{
mListeners->stopping();
}
- mLogger.getInfoStream() << current.adapter->getCommunicator()->identityToString(current.id) << ": shutting down." << std::endl;
+ lg(Info) << current.adapter->getCommunicator()->identityToString(current.id) << ": shutting down." ;
mShuttingDown = true;
reap();
if(mBridges.size() > 0)
@@ -207,7 +215,7 @@ void AsteriskSCF::BridgeService::BridgeManagerImpl::shutdown(const Ice::Current&
void AsteriskSCF::BridgeService::BridgeManagerImpl::reap()
{
- mLogger.getDebugStream() << __FUNCTION__ << ": reaping bridge set of " << mBridges.size() << " bridges." << std::endl;
+ lg(Debug) << __FUNCTION__ << ": reaping bridge set of " << mBridges.size() << " bridges." ;
for(std::vector<BridgeInfo>::iterator i = mBridges.begin(); i != mBridges.end(); ++i)
{
if(i->servant->destroyed())
@@ -216,5 +224,5 @@ void AsteriskSCF::BridgeService::BridgeManagerImpl::reap()
mBridges.erase(t);
}
}
- mLogger.getDebugStream() << __FUNCTION__ << ": reaping completed, bridge set size is now " << mBridges.size() << "." << std::endl;
+ lg(Debug) << __FUNCTION__ << ": reaping completed, bridge set size is now " << mBridges.size() << "." ;
}
diff --git a/src/BridgeManagerImpl.h b/src/BridgeManagerImpl.h
index 392eea9..ef2be04 100644
--- a/src/BridgeManagerImpl.h
+++ b/src/BridgeManagerImpl.h
@@ -13,7 +13,6 @@
#include <vector>
#include "BridgeImpl.h"
-#include "BridgeLogger.h"
#include "BridgeManagerListenerMgr.h"
namespace AsteriskSCF
@@ -56,7 +55,6 @@ namespace BridgeService
bool mShuttingDown;
bool mSuspended;
Ice::ObjectAdapterPtr mAdapter;
- Logger mLogger;
AsteriskSCF::SessionCommunications::Bridging::V1::BridgeManagerPrx mSourceProxy;
BridgeManagerListenerMgrPtr mListeners;
void reap();
diff --git a/src/Service.cpp b/src/Service.cpp
index 30b16a1..d2d5530 100644
--- a/src/Service.cpp
+++ b/src/Service.cpp
@@ -6,7 +6,6 @@
* All rights reserved.
*/
#include "BridgeManagerImpl.h"
-#include "BridgeLogger.h"
#include <Ice/Ice.h>
#include <IceStorm/IceStorm.h>
@@ -15,6 +14,14 @@
#include "IceLogger.h"
#include "logger.h"
+using namespace AsteriskSCF::System::Logging;
+
+namespace
+{
+Logger &lg = getLoggerFactory().getLogger(
+ "AsteriskSCF.BridgeService");
+}
+
class BridgingApp : public Ice::Application
{
public:
@@ -29,8 +36,6 @@ private:
* A proxy to the service locator manager for the bridge manager service.
*/
AsteriskSCF::Core::Discovery::V1::ServiceManagementPrx mServiceManagement;
-
- AsteriskSCF::BridgeService::Logger mLogger;
};
BridgingApp::BridgingApp()
@@ -43,15 +48,13 @@ int BridgingApp::run(int, char*[])
{
callbackOnInterrupt();
- mLogger.getTraceStream() << "Launching AsteriskSCF Session-Oriented Bridging Service." << std::endl;
+ lg(Debug) << "Launching AsteriskSCF Session-Oriented Bridging Service." ;
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("AsteriskSCF.BridgeService");
// setup the logger
- AsteriskSCF::System::Logging::ConfiguredIceLoggerPtr iceLogger =
- AsteriskSCF::System::Logging::createIceLogger(adapter);
- AsteriskSCF::System::Logging::getLoggerFactory().setLogOutput(
- iceLogger->getLogger());
+ ConfiguredIceLoggerPtr iceLogger = createIceLogger(adapter);
+ getLoggerFactory().setLogOutput(iceLogger->getLogger());
AsteriskSCF::SessionCommunications::Bridging::V1::BridgeManagerPtr servant(new AsteriskSCF::BridgeService::BridgeManagerImpl(adapter, ManagerName));
AsteriskSCF::SessionCommunications::Bridging::V1::BridgeManagerPrx s(
commit b7a8d362bdfab840bcf6d9f2bb97c8a9a3462ea6
Author: David M. Lee <dlee at digium.com>
Date: Tue Oct 5 13:26:57 2010 -0500
Logger integration
diff --git a/.gitmodules b/.gitmodules
index 7e7b888..bf532f0 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -7,3 +7,6 @@
[submodule "test/channel_driver"]
path = test/channel_driver
url = ../../integration/test_channel
+[submodule "logger"]
+ path = logger
+ url = git at git.asterisk.org:asterisk-scf/integration/logger
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e9a9d68..f6c345d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,6 +22,9 @@ if(NOT integrated_build STREQUAL "true")
# Take care of slice definitions
add_subdirectory(slice)
+ # logger is integrated into our build
+ set(integrated_build true)
+ add_subdirectory(logger)
endif()
# Include the subdirectory information. This is separate so that
diff --git a/cmake b/cmake
index d30f7d1..e9cf9f2 160000
--- a/cmake
+++ b/cmake
@@ -1 +1 @@
-Subproject commit d30f7d1a5561c2bf086eacad2e0565c49c261e51
+Subproject commit e9cf9f2e6dd03fe7bc39c363d72812aceed28367
diff --git a/logger b/logger
new file mode 160000
index 0000000..0cc0c02
--- /dev/null
+++ b/logger
@@ -0,0 +1 @@
+Subproject commit 0cc0c02a16e404b94d54c8cb6736dee14a671352
diff --git a/slice b/slice
index 36a57a4..0c62939 160000
--- a/slice
+++ b/slice
@@ -1 +1 @@
-Subproject commit 36a57a423c849ff5688d8c4f3569bf3639feed36
+Subproject commit 0c629393e2f05dc0ed43bcc6305880949df36289
diff --git a/src/BridgeImpl.cpp b/src/BridgeImpl.cpp
index a279897..1069945 100644
--- a/src/BridgeImpl.cpp
+++ b/src/BridgeImpl.cpp
@@ -18,6 +18,10 @@
// TODO: Replace with configuration!
//
+AsteriskSCF::System::Logging::Logger &AsteriskSCF::BridgeService::lg =
+ AsteriskSCF::System::Logging::getLoggerFactory().getLogger(
+ "AsteriskSCF.BridgeService");
+
static const std::string TopicPrefix("AsteriskSCF.Bridge.");
//
diff --git a/src/BridgeImpl.h b/src/BridgeImpl.h
index 61f8e38..daf94bd 100644
--- a/src/BridgeImpl.h
+++ b/src/BridgeImpl.h
@@ -11,7 +11,7 @@
#include <SessionCommunications/SessionCommunicationsIf.h>
#include <boost/thread/shared_mutex.hpp>
#include <vector>
-#include "Logger.h"
+#include "BridgeLogger.h"
#include "MediaSplicer.h"
#include "BridgeListenerMgr.h"
diff --git a/src/BridgeLogger.h b/src/BridgeLogger.h
new file mode 100644
index 0000000..6116aad
--- /dev/null
+++ b/src/BridgeLogger.h
@@ -0,0 +1,48 @@
+/*
+ * Asterisk Scalable Communications Framework
+ *
+ * Copyright (C) 2010 -- Digium, Inc.
+ *
+ * All rights reserved.
+ */
+#pragma once
+
+#include "logger.h"
+
+namespace AsteriskSCF
+{
+namespace BridgeService
+{
+ extern System::Logging::Logger ≶
+ //
+ // Place holder log stream holder.
+ // TODO: now that we have a really logger class, we should replace this
+ // placeholder and remove this class..
+ //
+ class Logger
+ {
+ public:
+ System::Logging::CondStream getTraceStream()
+ {
+ return lg(System::Logging::Debug); // Logger doesn't go as low as trace
+ }
+
+ System::Logging::CondStream getErrorStream()
+ {
+ return lg(System::Logging::Error);
+ }
+
+ System::Logging::CondStream getDebugStream()
+ {
+ return lg(System::Logging::Debug);
+ }
+
+ bool debugTracing() { return lg.isEnabledFor(System::Logging::Debug); }
+
+ System::Logging::CondStream getInfoStream()
+ {
+ return lg(System::Logging::Info);
+ }
+ };
+} // End of namespace BridgeImpl
+} // End of namespace AsteriskSCF
diff --git a/src/BridgeManagerImpl.h b/src/BridgeManagerImpl.h
index ca8d90d..392eea9 100644
--- a/src/BridgeManagerImpl.h
+++ b/src/BridgeManagerImpl.h
@@ -13,7 +13,7 @@
#include <vector>
#include "BridgeImpl.h"
-#include "Logger.h"
+#include "BridgeLogger.h"
#include "BridgeManagerListenerMgr.h"
namespace AsteriskSCF
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9259d90..bb897a3 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -17,5 +17,13 @@ hydra_component_add_file(bridgeservice MediaSplicer.h)
hydra_component_add_file(bridgeservice MediaSplicer.cpp)
hydra_component_add_ice_libraries(bridgeservice IceStorm)
hydra_component_add_boost_libraries(bridgeservice thread)
+
+if(NOT logger_dir)
+ message(FATAL_ERROR "The logger directory could not be found ${logger_dir}")
+endif()
+include_directories(${logger_dir}/common)
+include_directories(${logger_dir}/client/src)
+
hydra_component_build_standalone(bridgeservice)
+target_link_libraries(bridgeservice logging-client)
hydra_component_install(bridgeservice RUNTIME bin "Bridge Service." Core)
diff --git a/src/Logger.h b/src/Logger.h
deleted file mode 100644
index cd363d2..0000000
--- a/src/Logger.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Asterisk Scalable Communications Framework
- *
- * Copyright (C) 2010 -- Digium, Inc.
- *
- * All rights reserved.
- */
-#pragma once
-
-#include <iostream>
-
-namespace AsteriskSCF
-{
-namespace BridgeService
-{
- //
- // Place holder log stream holder.
- //
- class Logger
- {
- public:
- Logger() :
- mTraceDebug(true)
- {
- }
-
- std::ostream& getTraceStream()
- {
- return std::cerr;
- }
-
- std::ostream& getErrorStream()
- {
- return std::cerr;
- }
-
- std::ostream& getDebugStream()
- {
- return std::cerr;
- }
-
- bool debugTracing() { return mTraceDebug; }
-
- std::ostream& getInfoStream()
- {
- return std::cerr;
- }
-
- private:
- bool mTraceDebug;
- };
-} // End of namespace BridgeImpl
-} // End of namespace AsteriskSCF
diff --git a/src/Service.cpp b/src/Service.cpp
index bff6be5..30b16a1 100644
--- a/src/Service.cpp
+++ b/src/Service.cpp
@@ -6,12 +6,14 @@
* All rights reserved.
*/
#include "BridgeManagerImpl.h"
-#include "Logger.h"
+#include "BridgeLogger.h"
#include <Ice/Ice.h>
#include <IceStorm/IceStorm.h>
#include "Core/Discovery/ServiceLocatorIf.h"
+#include "IceLogger.h"
+#include "logger.h"
class BridgingApp : public Ice::Application
{
@@ -39,12 +41,18 @@ static const std::string ManagerName = "BridgeManager";
int BridgingApp::run(int, char*[])
{
- callbackOnInterrupt();
+ callbackOnInterrupt();
mLogger.getTraceStream() << "Launching AsteriskSCF Session-Oriented Bridging Service." << std::endl;
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("AsteriskSCF.BridgeService");
+ // setup the logger
+ AsteriskSCF::System::Logging::ConfiguredIceLoggerPtr iceLogger =
+ AsteriskSCF::System::Logging::createIceLogger(adapter);
+ AsteriskSCF::System::Logging::getLoggerFactory().setLogOutput(
+ iceLogger->getLogger());
+
AsteriskSCF::SessionCommunications::Bridging::V1::BridgeManagerPtr servant(new AsteriskSCF::BridgeService::BridgeManagerImpl(adapter, ManagerName));
AsteriskSCF::SessionCommunications::Bridging::V1::BridgeManagerPrx s(
AsteriskSCF::SessionCommunications::Bridging::V1::BridgeManagerPrx::uncheckedCast(adapter->add(servant, communicator()->stringToIdentity(ManagerName))
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 7af05d0..aea9152 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -38,7 +38,17 @@ hydra_component_add_boost_libraries(bridging_unit_test unit_test_framework)
#
list(APPEND target_libs "test_channel_lib")
hydra_component_add_boost_libraries(bridging_unit_test thread)
+
+if(NOT logger_dir)
+ message(FATAL_ERROR "The logger directory could not be found ${logger_dir}")
+endif()
+include_directories(${logger_dir}/common)
+include_directories(${logger_dir}/client/src)
+
hydra_component_build_standalone(bridging_unit_test)
+
+target_link_libraries(bridging_unit_test logging-client)
+
hydra_component_install(bridging_unit_test RUNTIME bin "Bridging Test Driver." Core)
boost_add_test(bridging_unit_test)
-----------------------------------------------------------------------
--
asterisk-scf/integration/bridging.git
More information about the asterisk-scf-commits
mailing list