X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.utils.thread%2Fsrc%2Forg%2Fsimantics%2Futils%2Fthreads%2Flogger%2FThreadLogger.java;fp=bundles%2Forg.simantics.utils.thread%2Fsrc%2Forg%2Fsimantics%2Futils%2Fthreads%2Flogger%2FThreadLogger.java;h=2f3425c58b5be1975c3014fb7a1aee03c41154fa;hp=d569d4aad2a3c4b4c70fd7d95a3d0be9963c7b85;hb=f002990cb02c4842cdc992395117958f75fff68c;hpb=5f5747460a3330a1317395fedb60db33f6c00ab2 diff --git a/bundles/org.simantics.utils.thread/src/org/simantics/utils/threads/logger/ThreadLogger.java b/bundles/org.simantics.utils.thread/src/org/simantics/utils/threads/logger/ThreadLogger.java index d569d4aad..2f3425c58 100644 --- a/bundles/org.simantics.utils.thread/src/org/simantics/utils/threads/logger/ThreadLogger.java +++ b/bundles/org.simantics.utils.thread/src/org/simantics/utils/threads/logger/ThreadLogger.java @@ -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; + } }