Debugger

public final class Debugger

Debugger is a convenient tool for logging different Java objects, like string, collection, map, and etc., on debugging purpose. Since the logging of such objects may be expensive, the logging will only be turned on when the debug flag in the system module attached to this debugger is on.

Author:Hugo Y. K. Lam

Methods

attach

public static synchronized void attach(Module m)

Attach a system module to this debugger. All debugging logs will be logged to the specified system module.

Parameters:
  • m – the system module to be attached.

detach

public static synchronized void detach(Module m)

Detach a system module from this debugger. All debugging logs will be logged to the main system module.

Parameters:
  • m – the system module to be detached.

print

public static void print(Object obj)

Prints debugging logs of the specified object. If the given object is a collection set, like iterator and list, its elements will be printed accordingly.

Parameters:
  • obj – the object to be printed.