v2.10-0 (21000JUN2005)

Go4Log
Class TGo4Log


class TGo4Log
derived from TObject

This class handles all logging messages inside Go4.
Should replace the previous Trace mechanism.

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

Field Summary
 private static Bool_tfgbAutoMode
          User boolean to write log on demand or not
 private static Bool_tfgbLogfileEnabled
          General switch on/off log file output
 private static Bool_tfgbOutputEnabled
          General switch on/off log output
 const static const Text_t[]fgcDEBUG
          System debug message indicator
 const static const Text_t[]fgcDEFAULTLOG
          Name of default logfile
 const static const Text_t[]fgcERR
          Error message indicator
 const static const Text_t[]fgcINFO
          Info message indicator
 const static const Text_t[]fgcLEFT
          Prompt character left side
 private static Text_t[1024]fgcMessagetext
          Keeps latest message with all format indicators
 const static const Text_t[]fgcRIGHT
          Prompt character right side
 const static const Text_t[]fgcWARN
          Warning message indicator
 private static Int_tfgiIgnoreLevel
          all Messages with lower level are suppressed
 const static const UInt_tfguMESLEN
          Maximum message length allowd
 private static TGo4Log*fgxInstance
           
 private static std::ofstream*fgxLogfile
          optional logfile to store messages with time
 private static TStringfgxLogName
          Name of last logfile set
 private static TMutex*fgxMutex
          we use own mutex to protect the logging instance

Constructor Summary
 private TGo4Log()
           

Destructor Summary
 virtual synchronized ~TGo4Log()
           

Method Summary
 static voidAutoEnable(Bool_t on)
          set boolean for user action
 static voidCloseLogfile()
          Close logfile if existing
 static voidDebug(const Text_t* text, ... )
          User shortcut for message with prio 0
 static voidError(const Text_t* text, ... )
          User shortcut for message with prio 3
 static Int_tGetIgnoreLevel()
          Get threshold for output
 const static const Text_t*GetLogname()
          get name of last opened logfile
 static voidInfo(const Text_t* text, ... )
          User shortcut for message with prio 1
 static TGo4Log*Instance()
           
 static Bool_tIsAutoEnabled()
          get current user boolean
 static Bool_tIsLogfileEnabled()
          get current logfile state
 static Bool_tIsOutputEnabled()
          get current output state
 static voidLogfileEnable(Bool_t on)
          switch writing to logfile on or off
 const static const Text_t*Message(Int_t prio, const Text_t* text, ... )
          Display a message.
 static voidOpenLogfile(const Text_t* name, const Text_t* headercomment, Bool_t appendmode)
          Open file of name for logmessage output.
 static voidOutputEnable(Bool_t on)
          switch output on or off
 static voidset_trace_level(int )
          dummy for compatibility
 static voidSetIgnoreLevel(Int_t level)
          Define threshold for output
 static voidSetTracePriority(int )
          dummy for compatibility
 static voidStartTracing()
          For backward compatibility
 static voidStopTracing()
          For backward compatibility
 static voidWarn(const Text_t* text, ... )
          User shortcut for message with prio 2
 static voidWriteLogfile(const Text_t* text, Bool_t withtime)
          Write text to current logfile if this is open.

Field Detail

fgbAutoMode

private static Bool_t fgbAutoMode
User boolean to write log on demand or not

fgbLogfileEnabled

private static Bool_t fgbLogfileEnabled
General switch on/off log file output

fgbOutputEnabled

private static Bool_t fgbOutputEnabled
General switch on/off log output

fgcDEBUG

public const static const Text_t[] fgcDEBUG
System debug message indicator

fgcDEFAULTLOG

public const static const Text_t[] fgcDEFAULTLOG
Name of default logfile

fgcERR

public const static const Text_t[] fgcERR
Error message indicator

fgcINFO

public const static const Text_t[] fgcINFO
Info message indicator

fgcLEFT

public const static const Text_t[] fgcLEFT
Prompt character left side

fgcMessagetext

private static Text_t[1024] fgcMessagetext
Keeps latest message with all format indicators

fgcRIGHT

public const static const Text_t[] fgcRIGHT
Prompt character right side

fgcWARN

public const static const Text_t[] fgcWARN
Warning message indicator

fgiIgnoreLevel

private static Int_t fgiIgnoreLevel
all Messages with lower level are suppressed

fguMESLEN

public const static const UInt_t fguMESLEN
Maximum message length allowd

fgxInstance

private static TGo4Log* fgxInstance

fgxLogfile

private static std::ofstream* fgxLogfile
optional logfile to store messages with time

fgxLogName

private static TString fgxLogName
Name of last logfile set

fgxMutex

private static TMutex* fgxMutex
we use own mutex to protect the logging instance
Constructor Detail

TGo4Log

private TGo4Log()
Method Detail

~TGo4Log

public virtual synchronized ~TGo4Log()
Method Detail

AutoEnable

public static void AutoEnable(Bool_t on)
set boolean for user action

CloseLogfile

public static void CloseLogfile()
Close logfile if existing

Debug

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

Error

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

GetIgnoreLevel

public static Int_t GetIgnoreLevel()
Get threshold for output

GetLogname

public const static const Text_t* GetLogname()
get name of last opened logfile

Info

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

Instance

public static TGo4Log* Instance()

IsAutoEnabled

public static Bool_t IsAutoEnabled()
get current user boolean

IsLogfileEnabled

public static Bool_t IsLogfileEnabled()
get current logfile state

IsOutputEnabled

public static Bool_t IsOutputEnabled()
get current output state

LogfileEnable

public static void LogfileEnable(Bool_t on)
switch writing to logfile on or off

Message

public const static const Text_t* Message(Int_t prio, const Text_t* text, ... )
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

OpenLogfile

public static void OpenLogfile(const Text_t* name, const Text_t* headercomment, Bool_t appendmode)
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.

OutputEnable

public static void OutputEnable(Bool_t on)
switch output on or off

set_trace_level

public static void set_trace_level(int )
dummy for compatibility

SetIgnoreLevel

public static void SetIgnoreLevel(Int_t level)
Define threshold for output

SetTracePriority

public static void SetTracePriority(int )
dummy for compatibility

StartTracing

public static void StartTracing()
For backward compatibility

StopTracing

public static void StopTracing()
For backward compatibility

Warn

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

WriteLogfile

public static void WriteLogfile(const Text_t* text, Bool_t withtime)
Write text to current logfile if this is open. Prefix current
datime in each line if "withtime" is true

Association Links

to Class TGo4Log

to Class TMutex

we use own mutex to protect the logging instance

J.Adamczewski, M.Al-Turany, D.Bertini, H.G.Essel, S.Linev

30-06-2005