changes made after tupshins reconstruction
[org.ibex.core.git] / src / org / xwt / util / Log.java
index 329382f..ad266a0 100644 (file)
@@ -49,7 +49,7 @@ public class Log {
     private static final int BROWN = 33;
     private static final int GRAY = 37;
     
-    private static String color(int color, boolean bright, String s) {
+    private static String colorize(int color, boolean bright, String s) {
         if (!Log.color) return s;
         return
             "\033[40;" + (bright?"1;":"") + color + "m" +
@@ -61,14 +61,14 @@ public class Log {
     private static synchronized void log(Object o, Object message, int level) {
         if (firstMessage && !logDates) {
             firstMessage = false;
-            System.err.println(color(GREEN, false, "==========================================================================="));
+            System.err.println(colorize(GREEN, false, "==========================================================================="));
             diag(Log.class, "Logging enabled at " + new java.util.Date());
             if (color) diag(Log.class, "logging messages in " +
-                color(BLUE, true, "c") +
-                color(RED, true, "o") +
-                color(CYAN, true, "l") +
-                color(GREEN, true, "o") +
-                color(PURPLE, true, "r"));
+                colorize(BLUE, true, "c") +
+                colorize(RED, true, "o") +
+                colorize(CYAN, true, "l") +
+                colorize(GREEN, true, "o") +
+                colorize(PURPLE, true, "r"));
         }
 
         String classname;
@@ -83,7 +83,7 @@ public class Log {
         if (classname.length() > (logDates ? 14 : 20)) classname = classname.substring(0, (logDates ? 14 : 20));
         while (classname.length() < (logDates ? 14 : 20)) classname = " " + classname;
         classname = classname + (classname.trim().length() == 0 ? "  " : ": ");
-        classname = color(GRAY, true, classname);
+        classname = colorize(GRAY, true, classname);
         classname = classname.replace('$', '.');
 
         if (logDates) {
@@ -91,7 +91,7 @@ public class Log {
             if (lastDate == null || d.getYear() != lastDate.getYear() || d.getMonth() != lastDate.getMonth() || d.getDay() != lastDate.getDay()) {
                 String now = new java.text.SimpleDateFormat("EEE dd MMM yyyy").format(d);
                 System.err.println();
-                System.err.println(color(GRAY, false, "=== " + now + " =========================================================="));
+                System.err.println(colorize(GRAY, false, "=== " + now + " =========================================================="));
             }
             java.text.DateFormat df = new java.text.SimpleDateFormat("[EEE HH:mm:ss] ");
             classname = df.format(d) + classname;
@@ -111,7 +111,7 @@ public class Log {
                 while((s = br.readLine()) != null) m += s + "\n";
                 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"));
+                System.err.println(colorize(RED, true, "Logger: exception thrown by ByteArrayInputStream -- this should not happen"));
             }
             return;
         }
@@ -120,25 +120,25 @@ public class Log {
         while(str.indexOf('\t') != -1)
             str = str.substring(0, str.indexOf('\t')) + "    " + str.substring(str.indexOf('\t') + 1);
 
-        classname = color(GRAY, false, classname);
+        classname = colorize(GRAY, false, classname);
         int levelcolor = GRAY;
         boolean bright = true;
         switch (level) {
             case DIAGNOSTIC:  levelcolor = GREEN; bright = false; break;
             case ECHO:        levelcolor = BLUE;  bright = true;  break;
-            case DEBUG:       levelcolor = BLACK; bright = true;  break;
+            case DEBUG:       levelcolor = BROWN; bright = true;  break;
             case INFO:        levelcolor = GRAY;  bright = false; break;
             case WARN:        levelcolor = BROWN; bright = false; break;
             case ERROR:       levelcolor = RED;   bright = true;  break;
         }
 
         while(str.indexOf('\n') != -1) {
-            System.err.println(classname + color(levelcolor, bright, str.substring(0, str.indexOf('\n'))));
+            System.err.println(classname + colorize(levelcolor, bright, str.substring(0, str.indexOf('\n'))));
             classname = logDates ? "                " : "                      ";
-            classname = color(GRAY,false,classname);
+            classname = colorize(GRAY,false,classname);
             str = str.substring(str.indexOf('\n') + 1);
         }
-        System.err.println(classname + color(levelcolor, bright, str));
+        System.err.println(classname + colorize(levelcolor, bright, str));
     }
 
     public static void recursiveLog(String indent, String name, Object o) throws JSExn {