org.gillius.Util
Class CircularLog

java.lang.Object
  extended by org.gillius.Util.CircularLog

public class CircularLog
extends java.lang.Object

CircularLog is useful to provide the last 'n' log messages in a crash event, when extremely verbose logging is desired, and outputting to stdout/err would cause problems due to the amount of output.

The intention of this class is that writeLog calls would be injected temporarily into code, and then the debugger is used to view the actual log.

Author:
Jason Winnebeck

Field Summary
static int LOG_SIZE
           
 
Constructor Summary
CircularLog()
           
 
Method Summary
static java.util.List<java.lang.String> getFilteredMessages(java.lang.String filter)
          Returns getLastMessages() but filtered such that only log entries containing the filter string appear are in the returned list.
static java.util.List<java.lang.String> getLastMessages()
          Returns a copy of the last LOG_SIZE messages as a list.
static void writeLog(java.lang.String s)
          Writes a message to the log.
static void writeLog(java.lang.String format, java.lang.Object... args)
          Writes a message to the log using the String.format(String, Object[]) method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG_SIZE

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

CircularLog

public CircularLog()
Method Detail

writeLog

public static void writeLog(java.lang.String s)
Writes a message to the log.

Parameters:
s - non-null String

writeLog

public static void writeLog(java.lang.String format,
                            java.lang.Object... args)
Writes a message to the log using the String.format(String, Object[]) method.


getLastMessages

public static java.util.List<java.lang.String> getLastMessages()
Returns a copy of the last LOG_SIZE messages as a list.


getFilteredMessages

public static java.util.List<java.lang.String> getFilteredMessages(java.lang.String filter)
Returns getLastMessages() but filtered such that only log entries containing the filter string appear are in the returned list.



Copyright © 2008-2010 Jason Winnebeck. All Rights Reserved.