Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

TGo4Log Class Reference

This class handles all logging messages inside Go4. More...

#include <TGo4Log.h>

List of all members.

Public Methods

virtual ~TGo4Log ()

Static Public Methods

TGo4Log * Instance ()
void SetIgnoreLevel (Int_t level)
 Define threshold for output. More...

Int_t GetIgnoreLevel ()
 Get threshold for output. More...

void OutputEnable (Bool_t on=kTRUE)
 switch output on or off. More...

Bool_t IsOutputEnabled ()
 get current output state. More...

void LogfileEnable (Bool_t on=kTRUE)
 switch writing to logfile on or off. More...

Bool_t IsLogfileEnabled ()
 get current logfile state. More...

void AutoEnable (Bool_t on=kTRUE)
 set boolean for user action. More...

Bool_t IsAutoEnabled ()
 get current user boolean. More...

void OpenLogfile (const Text_t *name=0, const Text_t *headercomment=0, Bool_t appendmode=kFALSE)
 Open file of name for logmessage output. More...

void CloseLogfile ()
 Close logfile if existing. More...

const Text_t * GetLogname ()
 get name of last opened logfile. More...

const Text_t * Message (Int_t prio, const Text_t *text,...)
 Display a message. More...

void Debug (const Text_t *text,...)
 User shortcut for message with prio 0. More...

void Info (const Text_t *text,...)
 User shortcut for message with prio 1. More...

void Warn (const Text_t *text,...)
 User shortcut for message with prio 2. More...

void Error (const Text_t *text,...)
 User shortcut for message with prio 3. More...

void WriteLogfile (const Text_t *text, Bool_t withtime=kTRUE)
 Write text to current logfile if this is open. More...

void set_trace_level (int)
 dummy for compatibility. More...

void SetTracePriority (int)
 dummy for compatibility. More...

void StartTracing ()
 For backward compatibility. More...

void StopTracing ()
 For backward compatibility. More...


Static Public Attributes

const Text_t fgcLEFT [] = "GO4-"
 Prompt character left side. More...

const Text_t fgcRIGHT [] = " "
 Prompt character right side. More...

const Text_t fgcDEBUG [] = "d"
 System debug message indicator. More...

const Text_t fgcINFO [] = "*"
 Info message indicator. More...

const Text_t fgcWARN [] = "#"
 Warning message indicator. More...

const Text_t fgcERR [] = "!"
 Error message indicator. More...

const Text_t fgcDEFAULTLOG [] = "go4logfile.txt"
 Name of default logfile. More...

const UInt_t fguMESLEN = __MESSAGETEXTLENGTH__
 Maximum message length allowd. More...


Private Methods

 TGo4Log ()

Static Private Attributes

TGo4Log * fgxInstance = 0
TMutex * fgxMutex = 0
 we use own mutex to protect the logging instance. More...

Int_t fgiIgnoreLevel = 1
 all Messages with lower level are suppressed. More...

Bool_t fgbOutputEnabled = kTRUE
 General switch on/off log output. More...

Bool_t fgbLogfileEnabled = kTRUE
 General switch on/off log file output. More...

Bool_t fgbAutoMode = kFALSE
 User boolean to write log on demand or not. More...

Text_t fgcMessagetext [__MESSAGETEXTLENGTH__]
 Keeps latest message with all format indicators. More...

std::ofstream * fgxLogfile = 0
 optional logfile to store messages with time. More...

TString fgxLogName = TGo4Log::fgcDEFAULTLOG
 Name of last logfile set. More...


Detailed Description

This class handles all logging messages inside Go4.

Should replace the previous Trace mechanism.

Author:
J. Adamczewski
Since:
17-jun-2003

Definition at line 44 of file TGo4Log.h.


Constructor & Destructor Documentation

TGo4Log::~TGo4Log   [virtual]
 

Definition at line 58 of file TGo4Log.cxx.

References CloseLogfile().

TGo4Log::TGo4Log   [private]
 

Definition at line 47 of file TGo4Log.cxx.

References fgcDEFAULTLOG, fgxMutex, LogfileEnable(), and OpenLogfile().

Referenced by Instance().


Member Function Documentation

TGo4Log * TGo4Log::Instance   [static]
 

Definition at line 63 of file TGo4Log.cxx.

References fgxInstance, and TGo4Log().

Referenced by Debug(), Error(), Info(), main(), Message(), StartTracing(), StopTracing(), and Warn().

void TGo4Log::SetIgnoreLevel Int_t    level [static]
 

Define threshold for output.

Definition at line 175 of file TGo4Log.cxx.

References fgiIgnoreLevel.

Referenced by TGo4MainWindow::LogSettingsSlot(), main(), StartTracing(), and StopTracing().

Int_t TGo4Log::GetIgnoreLevel   [static]
 

Get threshold for output.

Definition at line 182 of file TGo4Log.cxx.

References fgiIgnoreLevel.

Referenced by TGo4ThreadHandler::DumpThreads(), TGo4Analysis::Process(), and TGo4AnalysisMainRunnable::Run().

void TGo4Log::OutputEnable Bool_t    on = kTRUE [static]
 

switch output on or off.

Definition at line 193 of file TGo4Log.cxx.

References fgbOutputEnabled.

Referenced by TGo4MainWindow::LogSettingsSlot(), TGo4Analysis::SendMessageToGUI(), and TGo4Task::SendStatusMessage().

Bool_t TGo4Log::IsOutputEnabled   [static]
 

get current output state.

Definition at line 200 of file TGo4Log.cxx.

References fgbOutputEnabled.

Referenced by TGo4Analysis::SendMessageToGUI(), and TGo4Task::SendStatusMessage().

void TGo4Log::LogfileEnable Bool_t    on = kTRUE [static]
 

switch writing to logfile on or off.

Definition at line 205 of file TGo4Log.cxx.

References fgbLogfileEnabled.

Referenced by TGo4MainWindow::LogSettingsSlot(), main(), OpenLogfile(), and TGo4Log().

Bool_t TGo4Log::IsLogfileEnabled   [static]
 

get current logfile state.

Definition at line 211 of file TGo4Log.cxx.

References fgbLogfileEnabled.

void TGo4Log::AutoEnable Bool_t    on = kTRUE [static]
 

set boolean for user action.

Definition at line 216 of file TGo4Log.cxx.

References fgbAutoMode.

Referenced by TGo4MainWindow::LogSettingsSlot().

Bool_t TGo4Log::IsAutoEnabled   [static]
 

get current user boolean.

Definition at line 222 of file TGo4Log.cxx.

References fgbAutoMode.

Referenced by TGo4MainWindow::StatusMessage().

void TGo4Log::OpenLogfile const Text_t *    name = 0,
const Text_t *    headercomment = 0,
Bool_t    appendmode = kFALSE
[static]
 

Open file of name for logmessage output.

If name=0, use defaultname containing pid. Optionally, headercomment text is set at beginning of file. If appendmode is true, existing file of same name is reused and extended by new messages.

Definition at line 229 of file TGo4Log.cxx.

References CloseLogfile(), fguMESLEN, fgxLogfile, fgxLogName, LogfileEnable(), and WriteLogfile().

Referenced by TGo4MainWindow::LogSettingsSlot(), main(), and TGo4Log().

void TGo4Log::CloseLogfile   [static]
 

Close logfile if existing.

Definition at line 319 of file TGo4Log.cxx.

References fgxLogfile.

Referenced by OpenLogfile(), and ~TGo4Log().

const Text_t * TGo4Log::GetLogname   [static]
 

get name of last opened logfile.

Definition at line 187 of file TGo4Log.cxx.

References fgxLogName.

const Text_t * TGo4Log::Message Int_t    prio,
const Text_t *    text,
...   
[static]
 

Display a message.

Argument pri defines message priority: 0: debug / trace output 1: info message 2: warning message >=3: error message Method returns formatted message string as printed out for further use

Definition at line 71 of file TGo4Log.cxx.

References fgcDEBUG, fgcERR, fgcINFO, fgcLEFT, fgcMessagetext, fgcRIGHT, fgcWARN, fgiIgnoreLevel, fguMESLEN, Instance(), and WriteLogfile().

Referenced by Debug(), Error(), TGo4ExportManager::Export(), TGo4ExportManager::ExportASCII(), TGo4ExportManager::ExportRadware(), TGo4ExportManager::ExportRoot(), TGo4BrowserSlots::ExportSelectedItems(), TGo4UserException::Handle(), Info(), TGo4WindowEditStatus::Print(), TGo4Condition::Print(), TGo4Marker::PrintMarker(), TGo4EventInfoSlots::PrintToLog(), TGo4Analysis::SendMessageToGUI(), TGo4Task::SendStatusMessage(), TGo4MainWindow::StatusMessage(), and Warn().

void TGo4Log::Debug const Text_t *    text,
...   
[static]
 

User shortcut for message with prio 0.

Definition at line 123 of file TGo4Log.cxx.

References fgiIgnoreLevel, fguMESLEN, Instance(), and Message().

Referenced by TGo4BufferQueue::AddBuffer(), TGo4ClientTask::AddLocalCommand(), TGo4SimpleEvent::AddSubEvent(), TGo4MbsSource::BuildMbsEvent(), TGo4Thread::Cancel(), TGo4TaskManager::ClientLogin(), TGo4TaskHandler::Connect(), TGo4TaskHandler::ConnectClientChannel(), TGo4HistogramServer::ConnectObjectClient(), TGo4ObjClient::ConnectServer(), TGo4TaskHandler::ConnectServerChannel(), TGo4AnalysisClient::Constructor(), TGo4EventServerFactory::CreateEventSource(), TGo4EventServerFactory::CreateEventStore(), TGo4EventServerFactory::CreateInputEvent(), TGo4TaskHandler::DisConnect(), TGo4TaskManager::DisConnectClient(), TGo4ThreadHandler::DumpThreads(), TGo4ComAction2::ExeCom(), TGo4ComAction1::ExeCom(), TGo4ComStop::ExeCom(), TGo4ComStart::ExeCom(), TGo4ComServerQuit::ExeCom(), TGo4ComRemoveClient::ExeCom(), TGo4ComRelaunch::ExeCom(), TGo4ComQuit::ExeCom(), TGo4ComMasterQuit::ExeCom(), TGo4ComLaunchClient::ExeCom(), TGo4ComFlush::ExeCom(), TGo4ComExecLine::ExeCom(), TGo4ComDisconnectSlave::ExeCom(), TGo4ComConnectSlave::ExeCom(), TGo4ComStopHistoServ::ExeCom(), TGo4ComStartHistoServ::ExeCom(), TGo4ComSetStore::ExeCom(), TGo4ComSetSource::ExeCom(), TGo4ComSetProtections::ExeCom(), TGo4ComSetProcessor::ExeCom(), TGo4ComSetPrintEvent::ExeCom(), TGo4ComSetPicture::ExeCom(), TGo4ComSetParameter::ExeCom(), TGo4ComSetLastStep::ExeCom(), TGo4ComSetFirstStep::ExeCom(), TGo4ComSetDynamicEntry::ExeCom(), TGo4ComSetCondition::ExeCom(), TGo4ComSetCanvas::ExeCom(), TGo4ComSetAnalysisStatus::ExeCom(), TGo4ComSaveAnalysisStatus::ExeCom(), TGo4ComRemoveDynamicEntry::ExeCom(), TGo4ComPrintHistograms::ExeCom(), TGo4ComPrintDynList::ExeCom(), TGo4ComPrintConditions::ExeCom(), TGo4ComLoadAnalysisStatus::ExeCom(), TGo4ComInitAnalysis::ExeCom(), TGo4ComGetTreeStructure::ExeCom(), TGo4ComGetPicture::ExeCom(), TGo4ComGetParameter::ExeCom(), TGo4ComGetObjectStatus::ExeCom(), TGo4ComGetObject::ExeCom(), TGo4ComGetNamesList::ExeCom(), TGo4ComGetEnvelope::ExeCom(), TGo4ComGetDynamicEntryStatus::ExeCom(), TGo4ComGetCurrentEvent::ExeCom(), TGo4ComGetCondition::ExeCom(), TGo4ComGetCanvas::ExeCom(), TGo4ComGetAnalysisStatus::ExeCom(), TGo4ComDeleteObject::ExeCom(), TGo4ComCreateObject::ExeCom(), TGo4ComCreateHistogram::ExeCom(), TGo4ComCreateCondition::ExeCom(), TGo4ComCopyObject::ExeCom(), TGo4ComCloseAnalysis::ExeCom(), TGo4ComClearObject::ExeCom(), TGo4ComAutosave::ExeCom(), TGo4ComAddTreeHistogram::ExeCom(), TYYYRawEvent::Fill(), TGo4MbsEvent::Fill(), TGo4EventElement::GetDataChar(), TGo4EventElement::GetDataDouble(), TGo4EventElement::GetDataFloat(), TGo4EventElement::GetDataInt(), TGo4EventElement::GetDataLong(), TGo4EventElement::GetDataShort(), TGo4Task::GetStatus(), TGo4TerminateException::Handle(), TGo4TaskHandlerAbortException::Handle(), TGo4RuntimeException::Handle(), TGo4Exception::Handle(), TGo4ControlException::Handle(), TGo4EventSourceException::Handle(), TGo4DynamicListException::Handle(), TGo4MbsEvent::Init(), TGo4ThreadManager::Initialization(), TGo4Task::Initialization(), TGo4CommandInvoker::Invoke(), TGo4ServerTask::LaunchClient(), TGo4Master::LaunchSlaveServer(), TGo4Task::NextStatus(), TGo4AppControlTimer::Notify(), TGo4Socket::Open(), TGo4TreeSource::Open(), TGo4MbsSource::Open(), TGo4MbsFile::OpenFile(), TGo4Runnable::PostRun(), TGo4Runnable::PreRun(), TGo4SimpleSubEvent::PrintEvent(), TGo4SimpleEvent::PrintEvent(), TGo4EventElement::PrintEvent(), TGo4ServerTask::Quit(), TGo4ClientTask::Quit(), TGo4MbsSubEvent::ReAllocate(), TGo4Socket::ReceiveBuffer(), TGo4ObjClient::ReceiveBuffer(), TGo4Thread::ReCreate(), TGo4Socket::Recv(), TGo4Socket::RecvRaw(), TGo4ServerTask::RemoveClient(), TGo4ServerTask::RemoveCurrentClient(), TGo4TestRunnable::Run(), TGo4StatusRunnable::Run(), TGo4DataRunnable::Run(), TGo4CommandRunnable::Run(), TGo4Socket::Send(), TGo4AnalysisClient::SendAnalysisClientStatus(), TGo4AnalysisClient::SendAnalysisStatus(), TGo4Socket::SendBuffer(), TGo4AnalysisClient::SendNamesList(), TGo4Task::SendObject(), TGo4HistogramServer::SendObject(), TGo4Task::SendStatus(), TGo4ServerTask::SendStatus(), TGo4Task::SendStatusBuffer(), TGo4ServerTask::SendStatusBuffer(), TGo4TaskManager::ServeClient(), TGo4TaskHandler::ServerRequest(), TGo4ServerTask::SetCurrentTask(), TGo4CommandProtoList::ShowCommands(), TGo4ServerTask::Shutdown(), TGo4ExampleClient::Start(), TGo4Slave::Start(), TGo4ExampleServer::StartWorkThreads(), TGo4TaskOwner::StartWorkThreads(), TGo4ExampleClient::Stop(), TGo4Slave::Stop(), TGo4ExampleServer::StopWorkThreads(), TGo4TaskOwner::StopWorkThreads(), TGo4TreeStore::Store(), TGo4FileStore::Store(), TGo4BackStore::Store(), TGo4EventStore::Store(), TGo4ThreadManager::Terminate(), TGo4AnalysisClient::TerminateFast(), TGo4AnalysisClient::TGo4AnalysisClient(), TGo4BackStore::TGo4BackStore(), TGo4DisplayDrawerTimer::TGo4DisplayDrawerTimer(), TGo4DisplayLoggerTimer::TGo4DisplayLoggerTimer(), TGo4ExampleClient::TGo4ExampleClient(), TGo4ExampleServer::TGo4ExampleServer(), TGo4FileStore::TGo4FileStore(), TGo4MainTree::TGo4MainTree(), TGo4MbsEventServer::TGo4MbsEventServer(), TGo4MbsFile::TGo4MbsFile(), TGo4MbsRandom::TGo4MbsRandom(), TGo4MbsStream::TGo4MbsStream(), TGo4MbsTransport::TGo4MbsTransport(), TGo4RevServ::TGo4RevServ(), TGo4Socket::TGo4Socket(), TGo4TaskHandler::TGo4TaskHandler(), TGo4Thread::TGo4Thread(), TGo4ThreadManager::TGo4ThreadManager(), TGo4TreeStore::TGo4TreeStore(), TGo4Runnable::ThreadCatch(), TGo4Thread::Threadfunc(), TGo4Runnable::UnexpectedCatch(), TGo4TaskHandler::WaitThreadStop(), TGo4Display::~TGo4Display(), TGo4MbsSubEvent::~TGo4MbsSubEvent(), and TGo4Thread::~TGo4Thread().

void TGo4Log::Info const Text_t *    text,
...   
[static]
 

User shortcut for message with prio 1.

Definition at line 136 of file TGo4Log.cxx.

References fgiIgnoreLevel, fguMESLEN, Instance(), and Message().

Referenced by TGo4TaskManager::AddClient(), TGo4TaskManager::DisConnectClient(), and TGo4FitPanelSlots::Fitter_PrintParameters().

void TGo4Log::Warn const Text_t *    text,
...   
[static]
 

User shortcut for message with prio 2.

Definition at line 149 of file TGo4Log.cxx.

References fgiIgnoreLevel, fguMESLEN, Instance(), and Message().

Referenced by TGo4TaskManager::AddClient(), TGo4TaskManager::ClientLogin(), TGo4ClientTask::ConnectServer(), TGo4Command::RefuseCom(), TGo4WinCond::SetPainter(), TGo4PolyCond::SetPainter(), and TGo4CondArray::SetPainter().

void TGo4Log::Error const Text_t *    text,
...   
[static]
 

User shortcut for message with prio 3.

Definition at line 162 of file TGo4Log.cxx.

References fguMESLEN, Instance(), and Message().

Referenced by TGo4TaskManager::AddClient(), TGo4ClientTask::ConnectServer(), TGo4AnalysisStepException::Handle(), TXXXCalibPar::ReadDatabase(), TGo4AnalysisClient::TGo4AnalysisClient(), and TXXXCalibPar::UpdateFrom().

void TGo4Log::WriteLogfile const Text_t *    text,
Bool_t    withtime = kTRUE
[static]
 

Write text to current logfile if this is open.

Prefix current datime in each line if "withtime" is true

Definition at line 280 of file TGo4Log.cxx.

References fgbLogfileEnabled, fguMESLEN, and fgxLogfile.

Referenced by Message(), and OpenLogfile().

void TGo4Log::set_trace_level int    [inline, static]
 

dummy for compatibility.

Definition at line 116 of file TGo4Log.h.

void TGo4Log::SetTracePriority int    [inline, static]
 

dummy for compatibility.

Definition at line 119 of file TGo4Log.h.

void TGo4Log::StartTracing   [inline, static]
 

For backward compatibility.

Definition at line 122 of file TGo4Log.h.

References Instance(), and SetIgnoreLevel().

void TGo4Log::StopTracing   [inline, static]
 

For backward compatibility.

Definition at line 125 of file TGo4Log.h.

References Instance(), and SetIgnoreLevel().


Member Data Documentation

const Text_t TGo4Log::fgcLEFT = "GO4-" [static]
 

Prompt character left side.

Definition at line 26 of file TGo4Log.cxx.

Referenced by Message().

const Text_t TGo4Log::fgcRIGHT = " " [static]
 

Prompt character right side.

Definition at line 28 of file TGo4Log.cxx.

Referenced by Message().

const Text_t TGo4Log::fgcDEBUG = "d" [static]
 

System debug message indicator.

Definition at line 29 of file TGo4Log.cxx.

Referenced by Message().

const Text_t TGo4Log::fgcINFO = "*" [static]
 

Info message indicator.

Definition at line 30 of file TGo4Log.cxx.

Referenced by Message().

const Text_t TGo4Log::fgcWARN = "#" [static]
 

Warning message indicator.

Definition at line 31 of file TGo4Log.cxx.

Referenced by Message().

const Text_t TGo4Log::fgcERR = "!" [static]
 

Error message indicator.

Definition at line 32 of file TGo4Log.cxx.

Referenced by Message().

const Text_t TGo4Log::fgcDEFAULTLOG = "go4logfile.txt" [static]
 

Name of default logfile.

Definition at line 33 of file TGo4Log.cxx.

Referenced by TGo4Log().

const UInt_t TGo4Log::fguMESLEN = __MESSAGETEXTLENGTH__ [static]
 

Maximum message length allowd.

Definition at line 34 of file TGo4Log.cxx.

Referenced by Debug(), Error(), Info(), Message(), TGo4Analysis::Message(), OpenLogfile(), TGo4UserException::TGo4UserException(), Warn(), and WriteLogfile().

TGo4Log * TGo4Log::fgxInstance = 0 [static, private]
 

Definition at line 43 of file TGo4Log.cxx.

Referenced by Instance().

TMutex * TGo4Log::fgxMutex = 0 [static, private]
 

we use own mutex to protect the logging instance.

Definition at line 42 of file TGo4Log.cxx.

Referenced by TGo4Log().

Int_t TGo4Log::fgiIgnoreLevel = 1 [static, private]
 

all Messages with lower level are suppressed.

Definition at line 37 of file TGo4Log.cxx.

Referenced by Debug(), GetIgnoreLevel(), Info(), Message(), SetIgnoreLevel(), and Warn().

Bool_t TGo4Log::fgbOutputEnabled = kTRUE [static, private]
 

General switch on/off log output.

Definition at line 38 of file TGo4Log.cxx.

Referenced by IsOutputEnabled(), and OutputEnable().

Bool_t TGo4Log::fgbLogfileEnabled = kTRUE [static, private]
 

General switch on/off log file output.

Definition at line 39 of file TGo4Log.cxx.

Referenced by IsLogfileEnabled(), LogfileEnable(), and WriteLogfile().

Bool_t TGo4Log::fgbAutoMode = kFALSE [static, private]
 

User boolean to write log on demand or not.

Definition at line 40 of file TGo4Log.cxx.

Referenced by AutoEnable(), and IsAutoEnabled().

Text_t TGo4Log::fgcMessagetext [static, private]
 

Keeps latest message with all format indicators.

Definition at line 36 of file TGo4Log.cxx.

Referenced by Message().

std::ofstream * TGo4Log::fgxLogfile = 0 [static, private]
 

optional logfile to store messages with time.

Definition at line 41 of file TGo4Log.cxx.

Referenced by CloseLogfile(), OpenLogfile(), and WriteLogfile().

TString TGo4Log::fgxLogName = TGo4Log::fgcDEFAULTLOG [static, private]
 

Name of last logfile set.

Definition at line 45 of file TGo4Log.cxx.

Referenced by GetLogname(), and OpenLogfile().


The documentation for this class was generated from the following files:
Generated on Tue Nov 8 10:56:45 2005 for Go4-v2.10-5 by doxygen1.2.15