27 #ifndef Gw_LogCollector
35 const char gkIndent[] = {ci,ci,ci,ci,ci,ci,ci,ci,ci,ci};
38 const char gLevel[] = {
'E',
'w',
'i',
'o'};
43 short LogMessage::gkMaxDepth = 5;
44 short LogMessage::gkAutoClear = 7;
46 short LogMessage::gDebug = 0;
51 fProcessMethodTicket(
""),
77 if ( global_debug_level < 0 )
80 gDebug = global_debug_level;
85 gkMaxDepth = max_indent;
87 if ( max_before_clear <= gkMaxDepth )
88 gkAutoClear = gkMaxDepth + 2;
90 gkAutoClear = max_before_clear;
95 if ( global_debug_level < 0 )
98 gDebug = global_debug_level;
104 if ( fIndentation < gkMaxDepth )
108 if ( fRealIndentation > gkAutoClear ) {
109 std::string
tmp = fProcessMethod; fProcessMethod = fProcessMethodTicket;
111 (*this) <<
"Automatic clear called since max value for depth calls "
112 << gkAutoClear <<
" reached. Probably a missing SetProcessMethod()/dolog bracket " <<
nline;
115 fProcessMethod =
tmp;
118 else fRealIndentation++;
126 fLowestLevel =
kInfo;
128 fIndentation = fRealIndentation = 0; fIsANewLine =
true;
134 if ( fIndentation ) {
143 if ( lev == fLevel && verbosity == fVerbosity )
146 fLevel = lev; fVerbosity = verbosity;
148 if ( fLevel < fLowestLevel )
149 fLowestLevel = fLevel;
155 (*this) <<
"|" << gLevel[fLevel] <<
"," << fVerbosity <<
"|" <<
nline;
161 fProcessMethodTicket = fProcessMethod;
164 fHeader <<
"[+[#" << fTicketNumber <<
"] |" << gLevel[fLevel] <<
"," << fVerbosity <<
"| "
169 fFooter <<
"[-[#" << fTicketNumber <<
"] "
173 fIndentation = fRealIndentation = 0;
179 if ( fIndentation == 0 ) {
180 fProcessMethod = method;
184 fProcessMethod = method;
187 (*this) <<
"[" <<
" -> ::" << fProcessMethod <<
" ]" <<
nline;
199 if ( fIndentation == 0 )
202 if ( fIndentation == 1 ) {
215 o.write(gkIndent,fIndentation);
222 o <<
"--------------------------------------------------------------------------------\n";
266 if ( log.fIsANewLine )
269 log.fCoreMsg <<
"\n"; log.fIsANewLine =
true;
virtual unsigned short GetVerboseLevel() const
To get the current level of the message.
LogMessage & error(LogMessage &)
LogMessage & warning(LogMessage &)
std::ostream & hline(std::ostream &)
LogMessage & nline(LogMessage &)
Base class for a Log message.
static void SetLogParameters(short global_debug_level=0, short max_indent=5, short max_before_clear=7)
to modify the global parameters
static void SetDebug(short global_debug_level=0)
virtual ~LogMessage()
should purge the message
header file for GwLogMessage.cpp
virtual void ClearMessage()
To clear the current message.
LogMessage(const char *pname, unsigned int pid=0u)
LogMessage & info(LogMessage &)
manipulator to modify the LogMessage
virtual void SetProcessPtr(void *address)
To set the Process address.
virtual void Send()
To send the message to the log collector.
LogMessage & dolog(LogMessage &)
LogMessage & debug(LogMessage &)
virtual void Indent()
to format the output string ... increase indent level
LogMessage & clear(LogMessage &)
others
virtual std::string & GetProcessName()
To get the Process name.
static LogCollector * theCollector()
return the current logcollector
ADF::LogMessage & endl(ADF::LogMessage &log)
virtual void DoCollect(LogMessage &)
Default, collect nothing !
virtual void SetProcessMethod(const char *)
To set the current method.
virtual std::string & GetProcessMethod()
To get the current method.
virtual void DoClear()
really clear the message
virtual void SetLevel(ELevel lev, unsigned short verbosity=0u)
To get the current level of the message.