Commits

Anonymous committed 3201b92

- Added swank and swank-events traces.
- Made enabled not final, so that tracing could be switched on-off programmatically.

  • Participants
  • Parent commits 19ac3be

Comments (0)

Files changed (2)

 # Turn on debug tracing for lispdev plugins
 org.lispdev.log/trace/debug=false
 org.lispdev.log/trace/console=false
+org.lispdev.log/trace/swank=false
+org.lispdev.log/trace/swank-events=false
 

File src/org/lispdev/log/Trace.java

 package org.lispdev.log;
 
 import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.eclipse.core.runtime.Platform;
 
  */
 public enum Trace
 {
+  /**
+   * General debug trace
+   */
   DEBUG("debug"),
-  CONSOLE("console");
+  /**
+   * Trace for org.lispdev.console
+   */
+  CONSOLE("console"),
+  /**
+   * Trace for org.lispdev.swank
+   */
+  SWANK("swank"),
+  /**
+   * Trace for org.lispdev.swank holding swank events
+   */
+  SWANK_EVENTS("swank-events")
+  ;
 
-  public final boolean enabled;
+  public boolean enabled;
   private final String tag;
+  private boolean saveLog;
+  private final List<String> log = new ArrayList<String>();
 
   private Trace(String tag)
   {
     {
       out = System.out;
     }
-    out.print(sb.toString());
+    final String res = sb.toString();
+    out.print(res);
+    if( saveLog )
+    {
+      log.add(res);
+    }
+  }
+
+  public void setSaveLog(boolean x)
+  {
+    if( x && x != saveLog )
+    {
+      saveLog = true;
+      log.clear();
+    }
+  }
+
+  public List<String> getLog()
+  {
+    return log;
   }
 }