27 #define Gw_LOGMESSAGE_H Gw_LogMessage
38 LogMessage &
info(LogMessage &);
39 LogMessage &
warning(LogMessage &);
40 LogMessage &
error(LogMessage &);
41 LogMessage &
debug(LogMessage &);
42 LogMessage &
dolog(LogMessage &);
45 LogMessage &
clear(LogMessage &);
46 LogMessage &
nline(LogMessage &);
48 std::ostream &
hline (std::ostream &);
117 static short gkMaxDepth;
119 static short gkAutoClear;
123 std::string fProcessName;
125 std::string fProcessMethod;
127 std::string fProcessMethodTicket;
130 unsigned int fProcessID;
140 unsigned int fTicketNumber;
146 unsigned short fVerbosity;
150 unsigned short fIndentation;
152 unsigned short fRealIndentation;
158 std::ostringstream fHeader;
160 std::ostringstream fCoreMsg;
162 std::ostringstream fFooter;
171 virtual void Indent(std::ostream &);
176 LogMessage(
const char *pname,
unsigned int pid = 0u);
180 static void SetLogParameters(
short global_debug_level = 0,
short max_indent = 5,
short max_before_clear = 7);
181 static void SetDebug(
short global_debug_level = 0);
185 {
return debug_to_test <= gDebug; }
209 {
return fProcessID; }
212 { fProcessID = pid; }
221 { fProcessPtr = address; }
225 {
return fProcessName; }
228 {
return fProcessMethod; }
270 {
return fLowestLevel; }
273 { fVerbosity = verbosity; }
276 {
return fVerbosity; }
282 {
return fCoreMsg.str() ; }
288 {
return fHeader.str() ; }
291 {
return fFooter.str() ; }
295 { (*pf)(*this);
return (*
this); }
300 if ( fDebug > gDebug )
304 if ( fIndentation == 0 )
308 Indent(fCoreMsg); fIsANewLine =
false;
virtual void SetPID(unsigned int pid)
To set the Process ID number.
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 unsigned int GetPID() const
To get the Process ID number.
virtual std::string Message() const
To get the current message.
virtual ~LogMessage()
should purge the message
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.
virtual std::string Footer() const
To get the Footer of the current message.
LogMessage & dolog(LogMessage &)
bool IsDebug(short debug_to_test) const
to test if the required debug level is lower that the global one
LogMessage & debug(LogMessage &)
virtual void Indent()
to format the output string ... increase indent level
LogMessage & clear(LogMessage &)
others
virtual void SetVerboseLevel(unsigned short verbosity)
To get the current level of the message.
virtual std::string & GetProcessName()
To get the Process name.
virtual ELevel GetLevel() const
To get the current level of the message.
virtual LogMessage & operator<<(LogMessage &(*pf)(LogMessage &))
To allow manipulators.
virtual std::ostringstream & operator()()
Allow to pass the underlying stream to funtions/methods.
virtual void SetProcessMethod(const char *)
To set the current method.
virtual std::string & GetProcessMethod()
To get the current method.
virtual std::string Header() const
To get the header of the current message.
virtual void DoClear()
really clear the message
virtual void SetLevel(ELevel lev, unsigned short verbosity=0u)
To get the current level of the message.
virtual ELevel GetLowestLevel() const
To get the current level of the message.
LogMessage & operator<<(T t)
send any request to the underlying ostringstream