31 #ifndef Gw_LogCollector
43 fIsDeleteByCentralLog(isdelbycental)
64 std::string
tmp = name;
66 if ( tmp ==
"cout" ) {
67 fOutputStream = &std::cout;
69 if ( tmp ==
"cerr" ) {
70 fOutputStream = &std::cerr;
72 if ( tmp ==
"clog" ) {
73 fOutputStream = &std::clog;
75 if ( fOutputStream == 0x0 )
76 { fOutputStream =
new std::ofstream(
GetName().data(),std::ios_base::app) ; }
80 bool donot = fOutputStream == &std::cout || fOutputStream == &std::cerr || fOutputStream == &std::clog ;
82 if ( fOutputStream )
delete fOutputStream;
90 std::string message = alogmsg.
Message();
91 if ( message.size() < 1 )
94 if ( fOutputStream ) {
96 (*fOutputStream) << alogmsg.
Header();
98 (*fOutputStream) << message;
100 if ( message[message.size()-1] !=
'\n' )
102 (*fOutputStream) << alogmsg.
Footer();
105 fOutputStream->flush();
virtual ~OStreamCollector()
virtual void DoCollect(LogMessage &)
write the message in a file
Base class for a Log message.
virtual std::string Message() const
To get the current message.
header file for GwLogMessage.cpp
virtual std::string & GetName()
OStreamCollector(const char *, bool isdelbycental=false)
unsigned short fMinLevel
to send to the log server only message having their level between min and max
Base class for a Log collector.
virtual std::string Footer() const
To get the Footer of the current message.
LogCollector * GetCurrentLogCollector() const
Return the current logcollector.
LogCollector(const char *, bool isdelbycental=false)
virtual ELevel GetLevel() const
To get the current level of the message.
static LogCollector * theCollector()
return the current logcollector
ADF::LogMessage & endl(ADF::LogMessage &log)
virtual std::string Header() const
To get the header of the current message.
Central log for all the Gammaware modules.
static CentralLog * theCentralLog()
CentralLog is a singleton.