Main Page   Class Hierarchy   Compound List   File List   Compound Members  

CAlarmLogger Class Reference

#include <CAlarmLogger.h>

List of all members.

Public Methods

 CAlarmLogger (string facility, string host="localhost", string port="daqalarm")
 The port to log to. More...

 CAlarmLogger (const CAlarmLogger &aCAlarmLogger)
 ~CAlarmLogger ()
string getFacility ()
string getHost ()
string getPort ()
void Log (string message)

Protected Methods

void setFacility (string fac)
void setHost (const string &host)
void setPort (const string &port)


Detailed Description

CAlarmLogger encapsulates an alarm logger object. CAlarmLoggers are created with the name of the facility doing the logging, a host and port number of the place to do the logging to. Typically, this is the host and port of the machine that the alarm displayer is running on.

Definition at line 41 of file CAlarmLogger.h.


Constructor & Destructor Documentation

CAlarmLogger::CAlarmLogger string facility,
string host = "localhost",
string port = "daqalarm"
 

The port to log to.

"Default Constructor" This is the default constructor which constructs a CAlarmLogger given a list of hosts to which it will form socket connections when logging events, and a facility name which will be the name of the facility doing the logging.

Parameters:
facility   - the name of the facility doing the logging

Definition at line 27 of file CAlarmLogger.cpp.

CAlarmLogger::CAlarmLogger const CAlarmLogger & aCAlarmLogger
 

"Copy Constructor" This is the copy constructor. It creates a new object by copying the information of the reference object which is its parameter.

Parameters:
aCAlarmLogger   - the reference object whose attributes will be copied.

Definition at line 53 of file CAlarmLogger.cpp.

CAlarmLogger::~CAlarmLogger
 

"Destructor" Called when an object goes out of scope, or when execution of the program is terminated. Destroys the object, and frees up space.

Definition at line 63 of file CAlarmLogger.cpp.


Member Function Documentation

void CAlarmLogger::Log string message
 

Operation Type: Log to file and screen

Attempts to log a message (facility, severity, message, date) to EventLog.tcl by opening a socket connection to each of the hosts in m_HostList. The first connection logs the message which consists of the facility, severity, and message to the log file via a call to the tcl procedure Logger::Log. This only needs to be written once, since the same log file will be used by each displayer. The Logger::Log tcl procedure obtains the exact time of the event via a call to date(1). It then returns the date string through the socket (which we read) and that string is what is displayed on the GUI via a call to Logger::Display_Event. In this way, the date on each display will be exactly the same. NOTE: If Log() fails for the first host in the list, then the event will not be written to the log file and will not be displayed anywhere. If connection to the first host succeeds, but fails on a subsequent host, the event will be logged to file but will not be displayed on whichever host connection failed. It will, however, be displayed on all hosts (including subsequent hosts) to which connection does not fail.

Exceptions:
CErrnoException   - Errno exception occurred
CTCPBadSocketState   - CSocket::m_State was not disconnected
CTCPNoSuchHost   - Host not in DNS or nonexistent
CTCPNoSuchService   - Named service does not translate.
CTCPConnectionFailed   - Connection refused by remote host
CTCPConnectionLost   - Connection terminated by remote host
Parameters:
sev   - This is an enumerated value which represent the severity of the event.
message   - This is the message which the caller wants to log.

Definition at line 99 of file CAlarmLogger.cpp.


The documentation for this class was generated from the following files:
Generated at Tue May 21 12:10:51 2002 for CAlarmLogger by doxygen1.2.9.1 written by Dimitri van Heesch, © 1997-2001