Package com.mckoi.debug
Class DefaultDebugLogger
java.lang.Object
com.mckoi.debug.DefaultDebugLogger
- All Implemented Interfaces:
DebugLogger
,Lvl
A default implementation of DebugLogger that logs messages to
a PrintWriter object.
This implementation allows for filtering of log messages of particular depth. So for example, only message above or equal to level ALERT are shown.
- Author:
- Tobias Downer
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
isInterestedIn
(int level) Queries the current debug level.final void
Sets up the system so that the debug messenger will intercept event dispatch errors and output the event to the debug stream.final void
setDebugLevel
(int level) Sets the debug level that's to be output to the stream.final void
Sets up the OutputStream to which the debug information is to be output to.final void
final void
This writes the given debugging string.final void
final void
writeException
(int level, Throwable e) This writes the given Exception but gives it a 'debug_level'.final void
This writes the given Exception.
-
Constructor Details
-
DefaultDebugLogger
public DefaultDebugLogger()
-
-
Method Details
-
setOutput
Sets up the OutputStream to which the debug information is to be output to. -
setDebugLevel
public final void setDebugLevel(int level) Sets the debug level that's to be output to the stream. Set to 255 to stop all output to the stream. -
listenToEventDispatcher
public final void listenToEventDispatcher()Sets up the system so that the debug messenger will intercept event dispatch errors and output the event to the debug stream. -
isInterestedIn
public final boolean isInterestedIn(int level) Description copied from interface:DebugLogger
Queries the current debug level. Returns true if the debug listener is interested in debug information of this given level. This can be used to speed up certain complex debug displaying operations where the debug listener isn't interested in the information be presented.- Specified by:
isInterestedIn
in interfaceDebugLogger
-
write
Description copied from interface:DebugLogger
This writes the given debugging string. It filters out any messages that are below the 'debug_level' variable. The 'object' variable specifies the object that made the call. 'level' must be between 0 and 255. A message of 'level' 255 will always print.- Specified by:
write
in interfaceDebugLogger
-
write
- Specified by:
write
in interfaceDebugLogger
-
write
- Specified by:
write
in interfaceDebugLogger
-
writeException
Description copied from interface:DebugLogger
This writes the given Exception. Exceptions are always output to the log stream.- Specified by:
writeException
in interfaceDebugLogger
-
writeException
Description copied from interface:DebugLogger
This writes the given Exception but gives it a 'debug_level'. This is so we can write out a warning exception.- Specified by:
writeException
in interfaceDebugLogger
-