]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.utils.thread/src/org/simantics/utils/threads/logger/ThreadLogger.java
Diagram threading and ThreadLogger improvements
[simantics/platform.git] / bundles / org.simantics.utils.thread / src / org / simantics / utils / threads / logger / ThreadLogger.java
index d569d4aad2a3c4b4c70fd7d95a3d0be9963c7b85..2f3425c58b5be1975c3014fb7a1aee03c41154fa 100644 (file)
@@ -19,7 +19,9 @@ import java.io.IOException;
 
 public class ThreadLogger implements IThreadLogger {
 
-    public static String LOG_FILE = "d:\\threads.log";
+    final private static ITask DUMMY = () -> {};
+
+    public static String LOG_FILE = "threads.log";
     
     public static boolean LOG = false;
 
@@ -44,7 +46,7 @@ public class ThreadLogger implements IThreadLogger {
             synchronized (loggerCreationLock) {
                 if(logger == null)
                     logger = new ThreadLogger();       
-            }                   
+            }
         }
         return logger;
     }
@@ -87,5 +89,12 @@ public class ThreadLogger implements IThreadLogger {
     public ITask begin(String taskName) {
         return new Task(taskName);
     }
+    
+    final public static ITask task(Object taskName) {
+        if(LOG)
+            return getInstance().begin(taskName.toString());
+        else
+            return DUMMY;
+    }
 
 }