LogConsoleBuffer cleanup

This commit is contained in:
zzz
2010-10-02 15:03:20 +00:00
parent 4a96e88118
commit 6100c799b7
2 changed files with 10 additions and 7 deletions

View File

@ -44,13 +44,16 @@ public class LogsHelper extends HelperBase {
}
******/
private String formatMessages(List msgs) {
/** formats in reverse order */
private String formatMessages(List<String> msgs) {
if (msgs.isEmpty())
return "<p><i>" + _("No log messages") + "</i></p>";
boolean colorize = Boolean.valueOf(_context.getProperty("routerconsole.logs.color")).booleanValue();
StringBuilder buf = new StringBuilder(16*1024);
buf.append("<ul>");
buf.append("<code>\n");
for (int i = msgs.size(); i > 0; i--) {
String msg = (String)msgs.get(i - 1);
String msg = msgs.get(i - 1);
buf.append("<li>");
if (colorize) {
String color;

View File

@ -11,8 +11,8 @@ import net.i2p.I2PAppContext;
*/
public class LogConsoleBuffer {
private I2PAppContext _context;
private final List _buffer;
private final List _critBuffer;
private final List<String> _buffer;
private final List<String> _critBuffer;
public LogConsoleBuffer(I2PAppContext context) {
_context = context;
@ -43,7 +43,7 @@ public class LogConsoleBuffer {
* in the logs)
*
*/
public List getMostRecentMessages() {
public List<String> getMostRecentMessages() {
synchronized (_buffer) {
return new ArrayList(_buffer);
}
@ -54,9 +54,9 @@ public class LogConsoleBuffer {
* in the logs)
*
*/
public List getMostRecentCriticalMessages() {
public List<String> getMostRecentCriticalMessages() {
synchronized (_critBuffer) {
return new ArrayList(_critBuffer);
}
}
}
}