From: megacz Date: Fri, 30 Jan 2004 07:43:35 +0000 (+0000) Subject: 2003/12/29 03:37:05 X-Git-Tag: RC3~225 X-Git-Url: http://git.megacz.com/?p=org.ibex.core.git;a=commitdiff_plain;h=77f562e1b6ef60e9ca0e9028dd4d4b9c8053dc69 2003/12/29 03:37:05 darcs-hash:20040130074335-2ba56-ba204d3d6f2215bc07e822499e8d1fcc31c66b12.gz --- diff --git a/src/org/xwt/js/JS.java b/src/org/xwt/js/JS.java index 0191a59..c6d5dd6 100644 --- a/src/org/xwt/js/JS.java +++ b/src/org/xwt/js/JS.java @@ -12,7 +12,7 @@ public class JS extends org.xwt.util.BalancedTree { // Static Interpreter Control Methods /////////////////////////////////////////////////////////////// /** log a message with the current JavaScript sourceName/line */ - public static void log(Object o, Object message) { logJS(message); } + public static void log(Object o, Object message) { log(message); } public static void log(Object message) { Log.echo(JS.getSourceName() + ":" + JS.getLine(), message); } public static int getLine() { diff --git a/src/org/xwt/util/Log.java b/src/org/xwt/util/Log.java index e536252..37bfd5c 100644 --- a/src/org/xwt/util/Log.java +++ b/src/org/xwt/util/Log.java @@ -24,6 +24,7 @@ public class Log { /** message can be a String or a Throwable */ public static synchronized void echo(Object o, Object message) { log(o, message, ECHO); } + public static synchronized void diag(Object o, Object message) { log(o, message, DIAGNOSTIC); } public static synchronized void debug(Object o, Object message) { log(o, message, DEBUG); } public static synchronized void info(Object o, Object message) { log(o, message, INFO); } public static synchronized void warn(Object o, Object message) { log(o, message, WARN); } @@ -49,6 +50,7 @@ public class Log { 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" + s + @@ -59,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("==========================================================================="); + System.err.println(color(GREEN, false, "===========================================================================")); String incolor = color ? "in " + color(BLUE, true, "c") + color(RED, true, "o") + color(CYAN, true, "l") + color(GREEN, true, "o") + color(PURPLE, true, "r") + " " : ""; - log(Log.class, "Logging enabled at " + new java.util.Date() + " " + incolor); + diag(Log.class, "Logging enabled at " + new java.util.Date() + " " + incolor); } String classname;