ibis.satin.impl.syncrewriter.util
Class Debug

java.lang.Object
  extended by ibis.satin.impl.syncrewriter.util.Debug

public class Debug
extends Object

Class to make debugging a bit easier. Supports indenting.


Field Summary
static int INDENTATION_WIDTH
           
static int NR_CHARS_ON_LINE
           
 
Constructor Summary
Debug()
          Instantiate a debug class on stdout without debugging on.
Debug(boolean turnOn, int startLevel)
          Instantiate a debug class on stdout with a certain start level.
 
Method Summary
 void error(String errorMessage, Object... arguments)
          Prints an error message.
 int getStartLevel()
          Returns the start level.
 void log(int level, String debugMessage, Object... arguments)
          Log (print) a debug message.
 boolean turnedOn()
          Tests whether debugging is turned on.
 void turnOff()
          Turns debugging off.
 void turnOn()
          Turns on debugging.
 void warning(String warningMessage, Object... arguments)
          Prints a warning message.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NR_CHARS_ON_LINE

public static final int NR_CHARS_ON_LINE
See Also:
Constant Field Values

INDENTATION_WIDTH

public static final int INDENTATION_WIDTH
See Also:
Constant Field Values
Constructor Detail

Debug

public Debug()
Instantiate a debug class on stdout without debugging on.


Debug

public Debug(boolean turnOn,
             int startLevel)
Instantiate a debug class on stdout with a certain start level.

Parameters:
turnOn - indicates if debugging should be on or off
startLevel - the start level of the indentation.
Method Detail

getStartLevel

public int getStartLevel()
Returns the start level.

Returns:
The start level of the indentation.

turnOn

public void turnOn()
Turns on debugging.


turnOff

public void turnOff()
Turns debugging off.


turnedOn

public boolean turnedOn()
Tests whether debugging is turned on.

Returns:
true if debugging is on; false otherwise.

error

public void error(String errorMessage,
                  Object... arguments)
Prints an error message. The startLevel will be ignored. So there is no indentation with error messages.

Parameters:
errorMessage - The error message to be printed.
arguments - Arguments satisfying the format specifiers of the errorMessage.

warning

public void warning(String warningMessage,
                    Object... arguments)
Prints a warning message. The startLevel will be ignored. So there is no indentation with warning messages.

Parameters:
warningMessage - The warning message to be printed.
arguments - Arguments satisfying the format specifiers of the warningMessage.

log

public void log(int level,
                String debugMessage,
                Object... arguments)
Log (print) a debug message. If debugging is turned off, nothing will be printed. The warning message will be printed with indentation equal to level + the start level of this debug instance.

Parameters:
level - The level of indentation of the message
debugMessage - The debugMessage to be printed.
arguments - The arguments satisfying the format specifiers of the debugMessage.


The Ibis project