com.panayotis.iodebug
Class Debug

java.lang.Object
  extended by com.panayotis.iodebug.Debug

public class Debug
extends java.lang.Object

This object is responsible to display debug and/or general information on any given Writer (by default to System.err).

It is possible to set another output writer, in order to redirect the errors whereever the programmer wants.


Field Summary
static int CRITICAL
          Only critical information is presented
static int ERROR
          Only errors and critical information is presented
static int INFO
          All messages except verbose messages are presented
static int QUIET
          Absolutely no debug information is presented
static int VERBOSE
          All messages are presented
static int WARNING
          Warnings, as well as errors and critical information is presented
 
Constructor Summary
Debug()
          Creates a new instance of Debug
 
Method Summary
 void msg(java.lang.String message, int level)
          Present a message on the Debug stream
 void setLevel(int level)
          Set the level of verbosity.
 void setWriter(java.io.Writer out)
          Set the output writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

QUIET

public static final int QUIET
Absolutely no debug information is presented

See Also:
Constant Field Values

CRITICAL

public static final int CRITICAL
Only critical information is presented

See Also:
Constant Field Values

ERROR

public static final int ERROR
Only errors and critical information is presented

See Also:
Constant Field Values

WARNING

public static final int WARNING
Warnings, as well as errors and critical information is presented

See Also:
Constant Field Values

INFO

public static final int INFO
All messages except verbose messages are presented

See Also:
Constant Field Values

VERBOSE

public static final int VERBOSE
All messages are presented

See Also:
Constant Field Values
Constructor Detail

Debug

public Debug()
Creates a new instance of Debug

Method Detail

setLevel

public void setLevel(int level)
Set the level of verbosity.

Parameters:
level - Only messages at least as critical as this level are presented.

msg

public void msg(java.lang.String message,
                int level)
Present a message on the Debug stream

Parameters:
message - Message to display. Automatically adds a newline at the end of the string.
level - Level of verbosity. If this level is les critical than the desired level, the message is not displayed.

setWriter

public void setWriter(java.io.Writer out)
Set the output writer. By default this is the System.err stream.

Parameters:
out - The Debug stream writer.