Add utility method for logging exceptions.

This commit is contained in:
akwizgran
2018-06-15 17:09:33 +01:00
parent b026031d66
commit d5d6db6723
85 changed files with 327 additions and 278 deletions

View File

@@ -1,10 +1,11 @@
package org.briarproject.bramble.util;
import java.util.logging.Level;
import java.util.logging.Logger;
import static java.util.logging.Level.FINE;
public class TimeUtils {
public class LogUtils {
private static final int NANOS_PER_MILLI = 1000 * 1000;
@@ -28,4 +29,8 @@ public class TimeUtils {
logger.fine(task + " took " + duration + " ms");
}
}
public static void logException(Logger logger, Level level, Throwable t) {
if (logger.isLoggable(level)) logger.log(level, t.toString(), t);
}
}