bugfix in url parsing for HTTP.java
[org.ibex.core.git] / src / org / ibex / util / Log.java
index 1766be9..de7fe8d 100644 (file)
@@ -15,6 +15,7 @@ import java.net.*;
 public class Log {
 
     public static boolean on = true;
+    public static boolean rpc = false;
     public static boolean color = false;
     public static boolean verbose = false;
     public static boolean logDates = false;
@@ -73,11 +74,14 @@ public class Log {
 
     private static String lastClassName = null;
     private static synchronized void log(Object o, Object message, int level) {
-        if (level > Log.level) return;
+        if (level < Log.level) return;
         if (firstMessage && !logDates) {
             firstMessage = false;
             logstream.println(colorize(GREEN, false, "==========================================================================="));
-            diag(Log.class, "Logging enabled at " + new java.util.Date());
+
+            // FIXME later: causes problems with method pruning
+            //diag(Log.class, "Logging enabled at " + new java.util.Date());
+
             if (color) diag(Log.class, "logging messages in " +
                 colorize(BLUE, true, "c") +
                 colorize(RED, true, "o") +
@@ -126,14 +130,16 @@ public class Log {
             try {
                 String m = "";
                 while((s = br.readLine()) != null) m += s + "\n";
-                log(o, m.substring(0, m.length() - 1), level);
+                if (m.length() > 0) log(o, m.substring(0, m.length() - 1), level);
             } catch (IOException e) {
                 logstream.println(colorize(RED, true, "Logger: exception thrown by ByteArrayInputStream -- this should not happen"));
             }
+            lastClassName = "";
             return;
         }
 
         String str = message.toString();
+        if (str.indexOf('\n') != -1) lastClassName = "";
         while(str.indexOf('\t') != -1)
             str = str.substring(0, str.indexOf('\t')) + "    " + str.substring(str.indexOf('\t') + 1);