QMsgLogger Class Reference

List of all members.

Detailed Description

Author:
sergio.didomizio@ge.infn.it


Public Member Functions

virtual ~QMsgLogger ()
 destructor
bool HasError () const
void ResetError ()
const QErrorGetError () const
bool RegisterProcess (const std::string &process, const std::string &host, pid_t pid)
 register process to message logger
bool ReleaseProcess (const std::string &process)
 unregister previously registered process
bool UpdateStatus (const std::string &process, ProcessStatus_t status)
 update process status informations
void WriteLog (MsgLevel severity, const std::string &sender, const std::string &message)
 write message supplied by external processes
void Write (const std::string &message, MsgLevel severity)
 write message not supplied by external processes)
std::list< std::string > GetRegisteredProcesses () const
 get a vector containing names of registered processes
bool GetProcessInfo (const std::string &process, pid_t *pid, ProcessStatus_t *status, std::string *host)
 get informations regarding a particular process

Static Public Member Functions

static QMsgLoggerGetInstance ()
 singleton

Private Member Functions

 QMsgLogger ()
 private constructor
const std::string & GetTime () const
 get current date and time formatted as a string
const std::string & FormatForLog (MsgLevel severity) const
 translate a 'severity' string into a format suitable for log file

Private Attributes

std::map< std::string, QProcessInfo_t * > fProcesses
 map of registered processes and corresponding informations
std::ofstream fOs
QError fError

Classes

struct  QProcessInfo_t


Member Function Documentation

bool QMsgLogger::RegisterProcess ( const std::string &  process,
const std::string &  host,
pid_t  pid 
)

register process to message logger

Parameters:
process process name
host process host
pid process pid
Returns:
true on success, false if another process with the same name is already registered

bool QMsgLogger::ReleaseProcess ( const std::string &  process  ) 

unregister previously registered process

Parameters:
process process name
Returns:
true on success, false if there are no registered processes with this name

bool QMsgLogger::UpdateStatus ( const std::string &  process,
ProcessStatus_t  status 
)

update process status informations

Parameters:
process process name
status new process status
Returns:
true on success, false if there are no registered processes with this name

void QMsgLogger::WriteLog ( MsgLevel  severity,
const std::string &  sender,
const std::string &  message 
)

write message supplied by external processes

Parameters:
severity message severity
sender sender process
message text message
Message is written to log file even if sender is not registered

void QMsgLogger::Write ( const std::string &  message,
MsgLevel  severity 
)

write message not supplied by external processes)

Parameters:
message text message
severity message severity

std::list< std::string > QMsgLogger::GetRegisteredProcesses (  )  const

get a vector containing names of registered processes

Returns:
vector of process names

bool QMsgLogger::GetProcessInfo ( const std::string &  process,
pid_t *  pid,
ProcessStatus_t status,
std::string *  host 
)

get informations regarding a particular process

Memory pointed by pid and status are filled with the corresponding informations. Pass NULL pointer to the quantities you are not interested in.

Parameters:
process the name of the wanted process
pid pointer to a variable that will be filled with Process Id
status pointer to a variable that will be filled with process status
status pointer to a variable that will be filled with the hostname of the requested process
Returns:
true on success, false if process is not registered

const std::string & QMsgLogger::GetTime (  )  const [private]

get current date and time formatted as a string

Returns:
string containing current date and time

const std::string & QMsgLogger::FormatForLog ( MsgLevel  severity  )  const [private]

translate a 'severity' string into a format suitable for log file

Parameters:
severity string to be formatted
Returns:
formatted string


The documentation for this class was generated from the following files:
Generated on Fri Mar 6 13:40:44 2009 for CUORE Software by  doxygen 1.5.1