Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
cx.ath.matthew.debug.Debug
public class Debug
extends Object
if (Debug.debug) Debug.print(Debug.INFO, "Debug Message");
Nested Class Summary | |
static interface |
|
Field Summary | |
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static boolean |
|
static PrintStream |
|
Method Summary | |
static void |
|
static boolean |
|
static boolean |
|
static void |
|
static void |
|
static void |
|
static void |
|
static void |
|
static void |
|
static void |
|
static void |
|
static void |
|
static void |
|
static void |
|
static void |
|
static void |
|
static void |
|
static void |
|
static void |
|
static void |
|
static void |
|
static void |
|
static void |
|
static void |
|
static void |
|
static void |
|
static void |
|
static void |
|
static void |
|
static void |
|
public static final int CRIT
Highest priority messages
- Field Value:
- 1
public static final int DEBUG
Debug messages
- Field Value:
- 5
public static final int ERR
Error messages
- Field Value:
- 2
public static final int INFO
Information
- Field Value:
- 4
public static final int VERBOSE
Verbose debug messages
- Field Value:
- 6
public static final int WARN
Warnings
- Field Value:
- 3
public static final boolean debug
Set this to false to disable compilation of Debug statements
- Field Value:
- false
public static PrintStream debugout
The current output stream (defaults to System.err)
public static void addFilterCommand(Class c, Debug.FilterCommand f)
Add a filter command for a specific type. This command will be called with the output stream and the text to be sent. It should perform any changes necessary to the text and then print the result to the output stream.
public static boolean debugging(Class c, int loglevel)
Deprecated. In Java 1.5 calling class is automatically identified, no need to pass it in.
public static boolean debugging(String s, int loglevel)
public static void loadConfig(File f) throws IOException
Read which class to debug on at which level from the given File. Syntax the same as Java Properties files:<class> = <debuglevel>E.G.cx.ath.matthew.io.TeeOutputStream = INFO cx.ath.matthew.io.DOMPrinter = DEBUGThe debug level can be one of CRIT, ERR, WARN, INFO, DEBUG or VERBOSE which correspond to all messages up to that level. The special words YES, ALL and TRUE cause all messages to be printed regardless of level. All other terms disable messages for that class. CRIT and ERR messages are always printed if debugging is enabled unless explicitly disabled. The special class name ALL can be used to set the default level for all classes.
- Parameters:
f
- File to read from.
public static void print(Class c, int loglevel, Object d)
Deprecated. In Java 1.5 calling class is automatically identified, no need to pass it in.
Log an Object
- Parameters:
c
- The class doing the loggingloglevel
- The level to log at (DEBUG, WARN, etc)d
- The object to log with d.toString()
public static void print(Class c, int loglevel, String s)
Deprecated. In Java 1.5 calling class is automatically identified, no need to pass it in.
Log a String
- Parameters:
c
- The class doing the loggingloglevel
- The level to log at (DEBUG, WARN, etc)s
- The log message
public static void print(Class c, int loglevel, Throwable t)
Deprecated. In Java 1.5 calling class is automatically identified, no need to pass it in.
Log a Throwable
- Parameters:
c
- The class doing the loggingloglevel
- The level to log at (DEBUG, WARN, etc)t
- The throwable to log with .toString and .printStackTrace
public static void print(Object d)
Log at DEBUG
- Parameters:
d
- The object to log
public static void print(Object o, Object d)
Deprecated. In Java 1.5 calling class is automatically identified, no need to pass it in.
Log at DEBUG
- Parameters:
o
- The object doing the loggingd
- The object to log
public static void print(Object o, int loglevel, Object d)
Deprecated. In Java 1.5 calling class is automatically identified, no need to pass it in.
Log an Object
- Parameters:
o
- The object doing the loggingloglevel
- The level to log at (DEBUG, WARN, etc)d
- The object to log with d.toString()
public static void print(Object o, int loglevel, String s)
Deprecated. In Java 1.5 calling class is automatically identified, no need to pass it in.
Log a String
- Parameters:
o
- The object doing the loggingloglevel
- The level to log at (DEBUG, WARN, etc)s
- The log message
public static void print(Object o, int loglevel, Throwable t)
Deprecated. In Java 1.5 calling class is automatically identified, no need to pass it in.
Log a Throwable
- Parameters:
o
- The object doing the loggingloglevel
- The level to log at (DEBUG, WARN, etc)t
- The throwable to log with .toString and .printStackTrace
public static void print(int loglevel, Object o)
Log an Object
- Parameters:
loglevel
- The level to log at (DEBUG, WARN, etc)o
- The object to log
public static void print(int loglevel, String s)
Log a String
- Parameters:
loglevel
- The level to log at (DEBUG, WARN, etc)s
- The string to log with d.toString()
public static void print(int loglevel, Throwable t)
Log a Throwable
- Parameters:
loglevel
- The level to log at (DEBUG, WARN, etc)t
- The throwable to log with .toString and .printStackTrace
- See Also:
to turn on stack traces.
public static void print(int loglevel, byte[] b)
Log a byte array
- Parameters:
loglevel
- The level to log at (DEBUG, WARN, etc)b
- The byte array to print.
public static void printMap(Class c, int loglevel, Map m)
Deprecated. In Java 1.5 calling class is automatically identified, no need to pass it in.
Log a Map
- Parameters:
c
- The class doing the loggingloglevel
- The level to log at (DEBUG, WARN, etc)m
- The Map to print out
public static void printMap(Map m)
Log a Map at DEBUG log level
- Parameters:
m
- The Map to print out
public static void printMap(Object o, int loglevel, Map m)
Deprecated. In Java 1.5 calling class is automatically identified, no need to pass it in.
Log a Map
- Parameters:
o
- The object doing the loggingloglevel
- The level to log at (DEBUG, WARN, etc)m
- The Map to print out
public static void printMap(int loglevel, Map m)
Log a Map
- Parameters:
loglevel
- The level to log at (DEBUG, WARN, etc)m
- The Map to print out
public static void setByteArrayCount(int count)
Set the size of hexdumps. (Default: 36)
public static void setByteArrayWidth(int width)
Set the formatted width of hexdumps. (Default: 80 chars)
public static void setHexDump(boolean hexdump)
Enable or disable hexdumps.
public static void setLineNos(boolean lines)
Enable or disable line numbers.
public static void setOutput() throws IOException
Output to the default debug.log
public static void setOutput(PrintStream p) throws IOException
Output to the given Stream
public static void setOutput(String filename) throws IOException
Output to the given file
public static void setProperties(Properties prop)
Set properties to configure debugging. Format of properties is class => level, e.g.cx.ath.matthew.io.TeeOutputStream = INFO cx.ath.matthew.io.DOMPrinter = DEBUGThe debug level can be one of CRIT, ERR, WARN, INFO, DEBUG or VERBOSE which correspond to all messages up to that level. The special words YES, ALL and TRUE cause all messages to be printed regardless of level. All other terms disable messages for that class. CRIT and ERR messages are always printed if debugging is enabled unless explicitly disabled. The special class name ALL can be used to set the default level for all classes.
- Parameters:
prop
- Properties object to use.
public static void setThrowableTraces(boolean ttrace)
Enable or disable stack traces in Debuging throwables.
public static void setTiming(boolean timing)
Enable or disable timing in Debug messages.