GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ADF::LogMessage Class Reference

Base class for a Log message. More...

#include <ADFLogMessage.h>

Public Types

enum  ELevel { kError, kWarning, kInfo, kOut }
 message level More...
 

Public Member Functions

virtual void ClearMessage ()
 To clear the current message. More...
 
virtual std::string Footer () const
 To get the Footer of the current message. More...
 
virtual ELevel GetLevel () const
 To get the current level of the message. More...
 
virtual ELevel GetLowestLevel () const
 To get the current level of the message. More...
 
virtual unsigned int GetPID () const
 To get the Process ID number. More...
 
virtual std::string & GetProcessMethod ()
 To get the current method. More...
 
virtual std::string & GetProcessName ()
 To get the Process name. More...
 
virtual unsigned short GetVerboseLevel () const
 To get the current level of the message. More...
 
virtual std::string Header () const
 To get the header of the current message. More...
 
bool IsDebug (short debug_to_test) const
 to test if the required debug level is lower that the global one More...
 
 LogMessage (const char *pname, unsigned int pid=0u)
 
virtual std::string Message () const
 To get the current message. More...
 
virtual std::ostringstream & operator() ()
 Allow to pass the underlying stream to funtions/methods. More...
 
virtual LogMessageoperator<< (LogMessage &(*pf)(LogMessage &))
 To allow manipulators. More...
 
template<class T >
LogMessageoperator<< (T t)
 send any request to the underlying ostringstream More...
 
virtual void Send ()
 To send the message to the log collector. More...
 
virtual void SetLevel (ELevel lev, unsigned short verbosity=0u)
 To get the current level of the message. More...
 
virtual void SetPID (unsigned int pid)
 To set the Process ID number. More...
 
virtual void SetProcessMethod (const char *)
 To set the current method. More...
 
virtual void SetProcessPtr (void *address)
 To set the Process address. More...
 
virtual void SetVerboseLevel (unsigned short verbosity)
 To get the current level of the message. More...
 
virtual ~LogMessage ()
 should purge the message More...
 

Static Public Member Functions

static void SetDebug (short global_debug_level=0)
 
static void SetLogParameters (short global_debug_level=0, short max_indent=5, short max_before_clear=7)
 to modify the global parameters More...
 

Protected Member Functions

virtual void DoClear ()
 really clear the message More...
 
virtual void Indent ()
 to format the output string ... increase indent level More...
 
virtual void Indent (std::ostream &)
 indent an ostream More...
 
void NewTicket ()
 

Friends

LogMessageclear (LogMessage &)
 others More...
 
LogMessagedebug (LogMessage &)
 
LogMessagedolog (LogMessage &)
 
LogMessageendl (LogMessage &)
 
LogMessageerror (LogMessage &)
 
LogMessageinfo (LogMessage &)
 manipulator to modify the LogMessage More...
 
LogMessagenline (LogMessage &)
 
LogMessagesep (LogMessage &)
 
LogMessagewarning (LogMessage &)
 

Detailed Description

Base class for a Log message.

A log message helps to send messages to a LogCollector. Depending of the current collector, the message could be treated differently (print out on the standard output, send it to a server etc ...).

A Process name, a process method and a process id (unsigned int) are associated to a LogMessage and can be changed with GetProcessName(), GetProcessMethod() and SetPID(). As well an address could be set to allow the separation between identical processes. By default it is the pointer on the allocated LogMessage but it could be configured by the user with SetProcessPtr

A log message has a level and a verbosity. Currently defined:

  • info : an information concerning the running conditions
  • warning : warning, something may be not good
  • error : potential crash of the system
  • out : could be used to write output results of intermediate results

The default value for the verbosity is 0. Use SetLevel to change the values.

Any basic type could be written in a log message. Here are some illustrations

void afunction ( ) {
// open a log message
LogMessage log; log.GetProcessName() = "";
// give the name of the function, method that defines a message. It starts a new ticket to be sent to the collector
log.SetProcessMethod("afunction");
log << info << "Hello world" << nline; // add hello world to the message
unsigned int i = 0;
log << info << " the value of i is " << i << nline; // add a value set in this function
Float_t ar[5];
if ( i > 4 )
log << error << " trying to access undefined slot in ar " << i << nline; // change status to error
log << dolog; // it sends the message to the collector
}

Definition at line 80 of file ADFLogMessage.h.


The documentation for this class was generated from the following files: