jclass
Class dbg

java.lang.Object
  |
  +--jclass.dbg

public class dbg
extends java.lang.Object

Class defining different level general purpose debugging facilities.

Written: Radu Sion
Version: 0.23
Source: dbg.java

Visit Smart Software 


Field Summary
static int ALL
           
 int debug_level
          This defines the current debug level.
static int DEBUG_LEVEL
          This defines the current debug level.
static int ERROR
           
static int FATAL
           
static int INFO
           
static int JUNK
           
static int MAX
           
static int MIN
           
static int NONE
           
static int TRUNCATESIZE
          This is a cut-size in bytes for each line of debuging output.
static int WARN
           
 
Constructor Summary
dbg()
          This constructor defaults the output to System.err.
dbg(java.io.PrintStream file)
          This constructor allows choosing a alternate logfile ...
  TD COLSPAN=2> Method Summary
 void close()
          Closes the underlying stream and defaults it to System.err.
static void p(int lvl, java.lang.Object ooo)
          Prints out the message only if lvl<=debug_level and debug_level!=NONE.
static void p(int lvl, java.lang.Object ooo, java.io.PrintStream p)
          Prints out debugging information.
 void pp(int lvl, java.lang.Object ooo)
          This uses the static version in order to print out to the internally specified printstream.
 void setPrintStream(java.io.PrintStream file)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NONE

public static final int NONE

JUNK

public static final int JUNK

INFO

public static final int INFO

WARN

public static final int WARN

ERROR

public static final int ERROR

FATAL

public static final int FATAL

MIN

public static final int MIN

MAX

public static final int MAX

ALL

public static final int ALL

TRUNCATESIZE

public static int TRUNCATESIZE
This is a cut-size in bytes for each line of debuging output. That means that every text is truncated to this length, before printout to stderr. You may modify this value in orde to change the default behaviour.

DEBUG_LEVEL

public static int DEBUG_LEVEL
This defines the current debug level. Only output for a debug level lower than this is allowed. This affects only the static versions of the functions. You may change this.

debug_level

public int debug_level
This defines the current debug level. Only output for a debug level lower than this is allowed. This affects only the dynamic versions of the methods. You may change this.
Constructor Detail

dbg

public dbg(java.io.PrintStream file)
This constructor allows choosing a alternate logfile ... If null it defaults to System.err.

dbg

public dbg()
This constructor defaults the output to System.err.
Method Detail

setPrintStream

public void setPrintStream(java.io.PrintStream file)

close

public void close()
           throws java.io.IOException
Closes the underlying stream and defaults it to System.err. Thus subsecvent writes will go to stderr.

pp

public void pp(int lvl,
               java.lang.Object ooo)
This uses the static version in order to print out to the internally specified printstream. Prints out the message only if lvl<=debug_level and debug_level!=NONE.

p

public static void p(int lvl,
                     java.lang.Object ooo)
Prints out the message only if lvl<=debug_level and debug_level!=NONE.

p

public static void p(int lvl,
                     java.lang.Object ooo,
                     java.io.PrintStream p)
Prints out debugging information. It truncates the printed strings according to the TRUNCATESIZE constant. The ideea is to avoid hacking through log files that grow very large. The current debugging level is determined by DEBUG_LEVEL.
Parameters:
ooo - The object that represents the debugging message
p - PrintStream to print to