TaskBean API
0.5

glogic.common.util
Class Debug

java.lang.Object
  extended byglogic.common.util.Debug

public final class Debug
extends java.lang.Object

Used for logging deubg statements. If you dont want the print debug statements to be compiled out then insure that the COMPILE var is compiled with the value of false. When COMPILE is false the code will not be compiled (or should not be depending on compiler implementation) when the following is done: if(Debug.COMPILE) if(Debug.COMPILE) Debug.print_1("Hello from debug land"); Order of execution to initize Debuging: Debug.setDebugPath("/tmp/myDebuFile"); //must be called first - set null if stdout to be used Debug.setDebug(true); //this will create the printstream //if not already created. Debug.setLevel(Debug.LEVEL1); //optional call to set LEVEL

Author:
Sam Taha

Field Summary
static boolean COMPILE
          When false the javac is free to eliminate the statement print_x()
static int LEVEL1
          Print LEVEL 1 statements
static int LEVEL2
          Print LEVEL 1 and 2 statements
static int LEVEL3
          Print LEVEL 1, 2, and 3 statements
 
Method Summary
static void cleanup()
          Description of the Method
static boolean getDebug()
          Gets the debug attribute of the Debug class
static java.lang.String getDebugClasses()
          Gets the debugClasses attribute of the Debug class
static boolean getDebugCompiled()
          Gets the debugCompiled attribute of the Debug class
static java.lang.String getDebugPath()
          Gets the debugPath attribute of the Debug class
static int getLevel()
          Gets the level attribute of the Debug class
static void print_1(java.lang.String msg, java.lang.Object obj)
          prints a debugging message to printstream if DEBUG is set and the level is in range.
static void print_1(java.lang.String msg, java.lang.Throwable e, java.lang.Object obj)
          Description of the Method
static void print_2(java.lang.String msg, java.lang.Object obj)
          Description of the Method
static void print_2(java.lang.String msg, java.lang.Throwable e, java.lang.Object obj)
          Description of the Method
static void print_3(java.lang.String msg, java.lang.Object obj)
          Description of the Method
static void print_3(java.lang.String msg, java.lang.Throwable e, java.lang.Object obj)
          Description of the Method
static void setDebug(boolean state)
          Sets the debug attribute of the Debug class
static void setDebugClasses(java.lang.String str)
           
static void setDebugPath(java.lang.String path)
          Sets the debugPath attribute of the Debug class
static void setLevel(int val)
          Sets the level attribute of the Debug class
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEVEL1

public static final int LEVEL1
Print LEVEL 1 statements

See Also:
Constant Field Values

LEVEL2

public static final int LEVEL2
Print LEVEL 1 and 2 statements

See Also:
Constant Field Values

LEVEL3

public static final int LEVEL3
Print LEVEL 1, 2, and 3 statements

See Also:
Constant Field Values

COMPILE

public static final boolean COMPILE
When false the javac is free to eliminate the statement print_x()

See Also:
Constant Field Values
Method Detail

getDebugPath

public static final java.lang.String getDebugPath()
Gets the debugPath attribute of the Debug class

Returns:
The debugPath value

setDebugPath

public static final void setDebugPath(java.lang.String path)
Sets the debugPath attribute of the Debug class

Parameters:
path - The new debugPath value

getDebugCompiled

public static final boolean getDebugCompiled()
Gets the debugCompiled attribute of the Debug class

Returns:
The debugCompiled value

getDebug

public static final boolean getDebug()
Gets the debug attribute of the Debug class

Returns:
The debug value

setDebug

public static final void setDebug(boolean state)
Sets the debug attribute of the Debug class

Parameters:
state - The new debug value

print_1

public static final void print_1(java.lang.String msg,
                                 java.lang.Object obj)
prints a debugging message to printstream if DEBUG is set and the level is in range. If null object no printing is done. For calls from static methods it is recommended you use the java.lang.Runtime class or create a statically declared inner class for the sole purpose of flagging the debug mode.

Parameters:
msg - Description of the Parameter
obj - Description of the Parameter

print_1

public static final void print_1(java.lang.String msg,
                                 java.lang.Throwable e,
                                 java.lang.Object obj)
Description of the Method

Parameters:
msg - Description of the Parameter
e - Description of the Parameter
obj - Description of the Parameter

print_2

public static final void print_2(java.lang.String msg,
                                 java.lang.Object obj)
Description of the Method

Parameters:
msg - Description of the Parameter
obj - Description of the Parameter

print_2

public static final void print_2(java.lang.String msg,
                                 java.lang.Throwable e,
                                 java.lang.Object obj)
Description of the Method

Parameters:
msg - Description of the Parameter
e - Description of the Parameter
obj - Description of the Parameter

print_3

public static final void print_3(java.lang.String msg,
                                 java.lang.Object obj)
Description of the Method

Parameters:
msg - Description of the Parameter
obj - Description of the Parameter

print_3

public static final void print_3(java.lang.String msg,
                                 java.lang.Throwable e,
                                 java.lang.Object obj)
Description of the Method

Parameters:
msg - Description of the Parameter
e - Description of the Parameter
obj - Description of the Parameter

getDebugClasses

public static final java.lang.String getDebugClasses()
Gets the debugClasses attribute of the Debug class

Returns:
The debugClasses value

setDebugClasses

public static final void setDebugClasses(java.lang.String str)
Parameters:
str - comma delimited string of Class names. If "ALL" then all classes are debug enabled. If empty or null then no debugging.

getLevel

public static final int getLevel()
Gets the level attribute of the Debug class

Returns:
The level value

setLevel

public static final void setLevel(int val)
Sets the level attribute of the Debug class

Parameters:
val - The new level value

cleanup

public static final void cleanup()
Description of the Method


TaskBean API
0.5

Copyright © Grand Logic, Inc. All Rights Reserved.