marf.util
Class Debug

java.lang.Object
  extended by java.lang.Thread
      extended by marf.util.BaseThread
          extended by marf.util.Logger
              extended by marf.util.Debug
All Implemented Interfaces:
java.lang.Runnable

public class Debug
extends Logger

Debugging Facility.

$Id: Debug.java,v 1.12 2005/07/14 00:59:20 mokhov Exp $

Since:
0.3.0
Version:
$Revision: 1.12 $
Author:
Serguei A. Mokhov, mokhov@cs.concordia.ca

Nested Class Summary
 
Nested classes/interfaces inherited from class marf.util.Logger
Logger.LogPrintStream
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
static boolean sbDebugOn
          Public debug flag.
 
Fields inherited from class marf.util.Logger
bAvailable, bNoTimestamp, iLogDirection, LOG_STDERR_TO_FILE, LOG_STDOUT_STDERR_TO_FILE, LOG_STDOUT_TO_FILE, LOG_TO_FILE_STDOUT_STDERR, oLog, strFilename, strLogMessage
 
Fields inherited from class marf.util.BaseThread
iTID, oTarget, siNextTID
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
protected Debug()
          Needed for logger.
 
Method Summary
static void debug()
          Issues an empty debug message if the flag is on with a trailing EOL.
static void debug(java.lang.Class poClass, java.lang.String pstrMsgString)
          Issues a debug message if the flag is on with a trailing EOL.
static void debug(java.lang.Object poObject)
          Issues a debug message if the flag is on with a trailing EOL by calling toString() of the parameter.
static void debug(java.lang.String pstrMsgString)
          Issues a debug message if the flag is on with a trailing EOL.
static void debug(java.lang.String pstrMsgString, boolean pbEOLNeeded)
          Issues a debug message if the flag is on.
static boolean enableDebug()
          Enables debugging.
static boolean enableDebug(boolean pbEnable)
          Enables or disables debugging based on the paramter.
static java.lang.String getMARFSourceCodeRevision()
          Retrieves class' revision.
 
Methods inherited from class marf.util.Logger
enableTimestamp, getLogDirection, getLogFilename, getLogPrintStream, isTimestampEnabled, setLogDirection, setLogFilename, setLogPrintStream
 
Methods inherited from class marf.util.BaseThread
getNextTID, getTarget, getTID
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sbDebugOn

public static boolean sbDebugOn
Public debug flag. Notice, multithreaded clients must synchronized on this themselves if they use the flag directly.

Constructor Detail

Debug

protected Debug()
         throws java.lang.Exception
Needed for logger. Sets the default filename to debug.log

Throws:
java.lang.Exception - if parent does
Method Detail

enableDebug

public static final boolean enableDebug(boolean pbEnable)
Enables or disables debugging based on the paramter. This method is properly synchronized.

Parameters:
pbEnable - to set the debug flag to
Returns:
old value of the debug flag

enableDebug

public static final boolean enableDebug()
Enables debugging. This method is properly synchronized.

Returns:
old value of the debug flag

debug

public static final void debug(java.lang.String pstrMsgString,
                               boolean pbEOLNeeded)
Issues a debug message if the flag is on. The message can have the trailing EOL or not based on the 2nd argument. This method is properly synchronized.

Parameters:
pstrMsgString - desired debug message to be issued
pbEOLNeeded - true if the trailing EOL is desired.

debug

public static final void debug(java.lang.String pstrMsgString)
Issues a debug message if the flag is on with a trailing EOL. This method is properly synchronized.

Parameters:
pstrMsgString - desired debug message to be issued

debug

public static final void debug(java.lang.Object poObject)
Issues a debug message if the flag is on with a trailing EOL by calling toString() of the parameter. This method is properly synchronized.

Parameters:
poObject - object to dump to the debug output
Since:
0.3.0.3

debug

public static final void debug(java.lang.Class poClass,
                               java.lang.String pstrMsgString)
Issues a debug message if the flag is on with a trailing EOL. This method is properly synchronized.

Parameters:
poClass - add class to extract the name from as a prefix
pstrMsgString - desired debug message to be issued

debug

public static final void debug()
Issues an empty debug message if the flag is on with a trailing EOL. This method is properly synchronized.


getMARFSourceCodeRevision

public static java.lang.String getMARFSourceCodeRevision()
Retrieves class' revision.

Returns:
revision string