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 booleanisInterestedIn(int level) Queries the current debug level.final voidSets up the system so that the debug messenger will intercept event dispatch errors and output the event to the debug stream.final voidsetDebugLevel(int level) Sets the debug level that's to be output to the stream.final voidSets up the OutputStream to which the debug information is to be output to.final voidfinal voidThis writes the given debugging string.final voidfinal voidwriteException(int level, Throwable e) This writes the given Exception but gives it a 'debug_level'.final voidThis 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:DebugLoggerQueries 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:
isInterestedInin interfaceDebugLogger
-
write
Description copied from interface:DebugLoggerThis 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:
writein interfaceDebugLogger
-
write
- Specified by:
writein interfaceDebugLogger
-
write
- Specified by:
writein interfaceDebugLogger
-
writeException
Description copied from interface:DebugLoggerThis writes the given Exception. Exceptions are always output to the log stream.- Specified by:
writeExceptionin interfaceDebugLogger
-
writeException
Description copied from interface:DebugLoggerThis writes the given Exception but gives it a 'debug_level'. This is so we can write out a warning exception.- Specified by:
writeExceptionin interfaceDebugLogger
-