25 #ifndef Gw_LogCollector
58 CentralLog::CentralLog() :
59 fCurrentCollector(0x0),
63 std::clog <<
"[[static]] CentralLog::CentralLog() ]\n[...\n" ;
64 std::clog <<
" Default collectors are built " <<
std::endl;
71 ChangeCollector(
"cout");
78 CentralLog::~CentralLog()
81 std::clog <<
"[[static]] CentralLog::~CentralLog() ]\n[...\n" ;
82 std::clog <<
" Collectors owned by Central Log are deleted " <<
std::endl;
85 fCurrentCollector = 0x0;
88 std::list< LogCollector * >::iterator
90 for ( listed_item = fListOfCollectors.begin() ; listed_item != fListOfCollectors.end() ; listed_item++ ) {
91 if ( (*listed_item)->IsDeleteByCentralLog() ) {
93 std::clog <<
" --> " << (*listed_item)->
GetName()
94 <<
" deleted from the central log ... ";
96 delete (*listed_item);
110 if ( gTheCentralLog == 0x0 ) {
112 gTheCentralLogDestroyer.SetSingleton (gTheCentralLog) ;
115 return gTheCentralLog;
123 std::list< LogCollector * >::iterator
125 for ( listed_item = fListOfCollectors.begin() ; listed_item != fListOfCollectors.end() ; listed_item++ ) {
126 if ( (*listed_item)->GetName() == whichlog ) {
127 fCurrentCollector = (*listed_item);
134 std::clog <<
"[[info]] CentralLog::ChangeCollector() ] [ "
135 << fCurrentCollector->
GetName() <<
" is now the current collector ]" <<
std::endl;
145 std::list< LogCollector * >::iterator
147 for ( listed_item = fListOfCollectors.begin() ; listed_item != fListOfCollectors.end() ; listed_item++ ) {
148 if ( (*listed_item)->GetName() == whichlog ) {
149 fCurrentCollector = (*listed_item);
161 return fCurrentCollector;
169 std::clog <<
"[[info]] CentralLog::Add() ] [ ";
171 if ( acollector == 0x0 ) {
173 std::clog <<
"cannot add null collectors to the central log ]" <<
std::endl;
179 std::list< LogCollector * >::iterator
181 for ( listed_item = fListOfCollectors.begin() ; listed_item != fListOfCollectors.end() ; listed_item++ ) {
182 if ( (*listed_item)->GetName() == acollector->
GetName() ) {
183 toremove = (*listed_item);
189 fListOfCollectors.erase(listed_item);
191 std::clog << toremove->
GetName()
192 <<
" removed from the central log ]" <<
std::endl;
196 fListOfCollectors.push_back( acollector );
198 std::clog << acollector->
GetName()
199 <<
" added to the central log ]" <<
std::endl;
bool IsCollector(std::string whichlog)
Check if the given collector already exists.
Base class for a Log collector.
bool ChangeCollector(std::string whichlog=std::string("Null"))
to change the current collector
virtual std::string & GetName()
Base class for a Log collector.
LogCollector * GetCurrentLogCollector() const
Return the current logcollector.
To properly destroy a singleton.
LogCollector * Add(LogCollector *)
Add a new LogCollector to the list of known collectors.
ADF::LogMessage & endl(ADF::LogMessage &log)
CentralLog is a singleton that should be destroyed at exit time.
Central log for all the Gammaware modules.
static CentralLog * theCentralLog()
CentralLog is a singleton.