org.mentalog.util.LogEventUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of menta-log Show documentation
Show all versions of menta-log Show documentation
A log library that embraces the kiss principle.
package org.mentalog.util;
import org.mentalog.Log;
import org.mentalog.LogEvent;
public class LogEventUtils {
private static volatile boolean isSynchronized;
private static ThreadLocal threadLocal;
private static final LogEvent singleLogEvent = new LogEvent();
static {
threadLocal = new ThreadLocal() {
@Override
protected LogEvent initialValue() {
return new LogEvent();
}
};
isSynchronized = Log.isSynchronized();
}
public final static LogEvent getLogEvent() {
if (isSynchronized) {
return threadLocal.get();
} else {
return singleLogEvent;
}
}
}