public class Log {
public static boolean on = true;
- public static boolean color = true;
+ public static boolean color = false;
public static boolean verbose = false;
public static boolean logDates = false;
public static Date lastDate = null;
private static final int PURPLE = 35;
private static final int BROWN = 33;
private static final int GRAY = 37;
-
+
private static String color(int color, boolean bright, String s) {
if (!Log.color) return s;
return
- "" + ((char)27) + "[" + (bright?1:0) + ";" + color + "m" +
+ "\033[40;" + (bright?"1;":"") + color + "m" +
s +
- ((char)27) + "[0m";
+ "\033[0m";
}
private static String lastClassName = null;
while (classname.length() < (logDates ? 14 : 20)) classname = " " + classname;
classname = classname + (classname.trim().length() == 0 ? " " : ": ");
classname = color(GRAY, true, classname);
+ classname = classname.replace('$', '.');
if (logDates) {
Date d = new Date();
try {
String m = "";
while((s = br.readLine()) != null) m += s + "\n";
- log(o, m, level);
+ log(o, m.substring(0, m.length() - 1), level);
} catch (IOException e) {
System.err.println(color(RED, true, "Logger: exception thrown by ByteArrayInputStream -- this should not happen"));
}
while(str.indexOf('\n') != -1) {
System.err.println(classname + color(levelcolor, bright, str.substring(0, str.indexOf('\n'))));
classname = logDates ? " " : " ";
+ classname = color(GRAY,false,classname);
str = str.substring(str.indexOf('\n') + 1);
}
System.err.println(classname + color(levelcolor, bright, str));