forked from I2P_Developers/i2p.i2p
color by default
This commit is contained in:
@ -50,11 +50,11 @@ public class LogsHelper extends HelperBase {
|
|||||||
private String formatMessages(List<String> msgs) {
|
private String formatMessages(List<String> msgs) {
|
||||||
if (msgs.isEmpty())
|
if (msgs.isEmpty())
|
||||||
return "<p><i>" + _("No log messages") + "</i></p>";
|
return "<p><i>" + _("No log messages") + "</i></p>";
|
||||||
boolean colorize = Boolean.valueOf(_context.getProperty("routerconsole.logs.color")).booleanValue();
|
boolean colorize = _context.getBooleanPropertyDefaultTrue("routerconsole.logs.color");
|
||||||
StringBuilder buf = new StringBuilder(16*1024);
|
StringBuilder buf = new StringBuilder(16*1024);
|
||||||
buf.append("<ul>");
|
buf.append("<ul>");
|
||||||
for (int i = msgs.size(); i > 0; i--) {
|
for (int i = msgs.size() - 1; i >= 0; i--) {
|
||||||
String msg = msgs.get(i - 1);
|
String msg = msgs.get(i);
|
||||||
msg = msg.replace("&", "&").replace("<", "<").replace(">", ">");
|
msg = msg.replace("&", "&").replace("<", "<").replace(">", ">");
|
||||||
// remove last \n that LogRecordFormatter added
|
// remove last \n that LogRecordFormatter added
|
||||||
if (msg.endsWith(NL))
|
if (msg.endsWith(NL))
|
||||||
@ -63,18 +63,18 @@ public class LogsHelper extends HelperBase {
|
|||||||
msg = msg.replace("\n", "<br> \n");
|
msg = msg.replace("\n", "<br> \n");
|
||||||
buf.append("<li>");
|
buf.append("<li>");
|
||||||
if (colorize) {
|
if (colorize) {
|
||||||
|
// TODO this would be a lot easier if LogConsoleBuffer stored LogRecords instead of formatted strings
|
||||||
String color;
|
String color;
|
||||||
// Homeland Security Advisory System
|
// Homeland Security Advisory System
|
||||||
// http://www.dhs.gov/xinfoshare/programs/Copy_of_press_release_0046.shtm
|
// http://www.dhs.gov/xinfoshare/programs/Copy_of_press_release_0046.shtm
|
||||||
// but pink instead of yellow for WARN
|
// but pink instead of yellow for WARN
|
||||||
// FIXME doesnt work for translated levels
|
if (msg.contains(_("CRIT")))
|
||||||
if (msg.contains("CRIT"))
|
|
||||||
color = "#cc0000";
|
color = "#cc0000";
|
||||||
else if (msg.contains("ERROR"))
|
else if (msg.contains(_("ERROR")))
|
||||||
color = "#ff3300";
|
color = "#ff3300";
|
||||||
else if (msg.contains("WARN"))
|
else if (msg.contains(_("WARN")))
|
||||||
color = "#ff00cc";
|
color = "#ff00cc";
|
||||||
else if (msg.contains("INFO"))
|
else if (msg.contains(_("INFO")))
|
||||||
color = "#000099";
|
color = "#000099";
|
||||||
else
|
else
|
||||||
color = "#006600";
|
color = "#006600";
|
||||||
|
Reference in New Issue
Block a user