smarter logging of exception stack traces
authoradam <adam@megacz.com>
Sat, 30 Oct 2004 22:51:42 +0000 (22:51 +0000)
committeradam <adam@megacz.com>
Sat, 30 Oct 2004 22:51:42 +0000 (22:51 +0000)
darcs-hash:20041030225142-5007d-aec982f8fc3831ba3afca6cedb1eaf1ab14e555e.gz

src/org/ibex/util/Log.java

index 5c67f68..aef3ba2 100644 (file)
@@ -177,10 +177,20 @@ public class Log {
                     while((s = br.readLine()) != null) m += s + "\n";
                     if (m.length() > 0) log(o, m.substring(0, m.length() - 1), level);
                 } else {
-                    message = br.readLine();
-                    String s = br.readLine();
-                    if (s.indexOf('(') != -1) message = message + " " + s.substring(s.indexOf('('));
-                    log(o, message, level);
+                    String m = br.readLine();
+                    int ok = 0;
+                    do {
+                        String s = br.readLine();
+                        if (s == null) break;
+                        if (s.indexOf('(') != -1) {
+                            String shortened = s.substring(s.indexOf('(')+1);
+                            shortened = shortened.substring(0, shortened.indexOf(')'));
+                            m += " " + shortened;
+                            if (ok > 1) m = m.substring(0, 78);
+                            ok++;
+                        }
+                    } while (m.length() < 78);
+                    log(o, m, level);
                 }
                 lastClassName = "";
             } catch (IOException e) {