25 #ifndef ADF_LogMessage
26 #define ADF_LogMessage
27 #define ADF_LOGMESSAGE_H _LogMessage
103 static short gkMaxDepth;
105 static short gkAutoClear;
109 std::string fProcessName;
111 std::string fProcessMethod;
113 std::string fProcessMethodTicket;
116 unsigned int fProcessID;
126 unsigned int fTicketNumber;
132 unsigned short fVerbosity;
136 unsigned short fIndentation;
138 unsigned short fRealIndentation;
144 std::ostringstream fHeader;
146 std::ostringstream fCoreMsg;
148 std::ostringstream fFooter;
157 virtual void Indent(std::ostream &);
162 LogMessage(
const char *pname,
unsigned int pid = 0u);
166 static void SetLogParameters(
short global_debug_level = 0,
short max_indent = 5,
short max_before_clear = 7);
167 static void SetDebug(
short global_debug_level = 0);
171 {
return debug_to_test <= gDebug; }
195 {
return fProcessID; }
198 { fProcessID = pid; }
207 { fProcessPtr = address; }
211 {
return fProcessName; }
214 {
return fProcessMethod; }
256 {
return fLowestLevel; }
259 { fVerbosity = verbosity; }
262 {
return fVerbosity; }
268 {
return fCoreMsg.str() ; }
274 {
return fHeader.str() ; }
277 {
return fFooter.str() ; }
281 { (*pf)(*this);
return (*
this); }
286 if ( fDebug > gDebug )
290 if ( fIndentation == 0 )
294 Indent(fCoreMsg); fIsANewLine =
false;
303 LogMessage &
info(LogMessage &);
304 LogMessage &
warning(LogMessage &);
305 LogMessage &
error(LogMessage &);
306 LogMessage &
debug(LogMessage &);
307 LogMessage &
dolog(LogMessage &);
310 LogMessage &
clear(LogMessage &);
311 LogMessage &
nline(LogMessage &);
312 LogMessage &
sep(LogMessage &);
314 std::ostream &
hline (std::ostream &);
317 LogMessage &
endl(LogMessage &);
friend LogMessage & info(LogMessage &)
manipulator to modify the LogMessage
virtual void SetLevel(ELevel lev, unsigned short verbosity=0u)
To get the current level of the message.
virtual ELevel GetLevel() const
To get the current level of the message.
LogMessage & info(LogMessage &)
manipulator to modify the LogMessage
static void SetDebug(short global_debug_level=0)
virtual ~LogMessage()
should purge the message
LogMessage & clear(LogMessage &)
others
virtual std::ostringstream & operator()()
Allow to pass the underlying stream to funtions/methods.
LogMessage & error(LogMessage &)
std::ostream & hline(std::ostream &)
friend LogMessage & sep(LogMessage &)
LogMessage(const char *pname, unsigned int pid=0u)
virtual std::string & GetProcessMethod()
To get the current method.
friend LogMessage & endl(LogMessage &)
virtual LogMessage & operator<<(LogMessage &(*pf)(LogMessage &))
To allow manipulators.
friend LogMessage & clear(LogMessage &)
others
LogMessage & debug(LogMessage &)
virtual void SetPID(unsigned int pid)
To set the Process ID number.
virtual void SetProcessMethod(const char *)
To set the current method.
bool IsDebug(short debug_to_test) const
to test if the required debug level is lower that the global one
LogMessage & nline(LogMessage &)
LogMessage & sep(LogMessage &)
virtual std::string Message() const
To get the current message.
friend LogMessage & error(LogMessage &)
virtual void Indent()
to format the output string ... increase indent level
virtual void ClearMessage()
To clear the current message.
friend LogMessage & debug(LogMessage &)
Base class for a Log message.
friend LogMessage & warning(LogMessage &)
static void SetLogParameters(short global_debug_level=0, short max_indent=5, short max_before_clear=7)
to modify the global parameters
virtual std::string Header() const
To get the header of the current message.
virtual ELevel GetLowestLevel() const
To get the current level of the message.
virtual unsigned short GetVerboseLevel() const
To get the current level of the message.
virtual void SetVerboseLevel(unsigned short verbosity)
To get the current level of the message.
LogMessage & dolog(LogMessage &)
virtual std::string & GetProcessName()
To get the Process name.
virtual void Send()
To send the message to the log collector.
LogMessage & operator<<(T t)
send any request to the underlying ostringstream
virtual void SetProcessPtr(void *address)
To set the Process address.
friend LogMessage & dolog(LogMessage &)
LogMessage & endl(LogMessage &)
virtual std::string Footer() const
To get the Footer of the current message.
virtual unsigned int GetPID() const
To get the Process ID number.
friend LogMessage & nline(LogMessage &)
LogMessage & warning(LogMessage &)
virtual void DoClear()
really clear the message