added logging to TDFUtils
@@ -49,6 +49,7 @@ import java.nio.IntBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -74,6 +75,7 @@ public class TDFUtils {
* @return true on success, false on failure.
*/
private static boolean loadLibrary() {
+ logger.finest("Initialising tdf library.");
File timsdataLib = null;
String libraryFileName;
try {
@@ -95,7 +97,7 @@ public class TDFUtils {
TDFUtils.class.getClassLoader());
} catch (IOException e) {
e.printStackTrace();
- logger.warning("Failed to load/extract timsdata library");
+ logger.log(Level.SEVERE,"Failed to load/extract timsdata library", e);
return false;
}
@@ -125,15 +127,19 @@ public class TDFUtils {
*/
public static long openFile(final File path, final long useRecalibratedState) {
if (!loadLibrary() || tdfLib == null) {
+ logger.warning(() -> "File + " + path.getAbsolutePath() + " cannot be loaded because tdf "
+ + "library could not be initialised.");
return 0L;
}
if (path.isFile()) {
+ logger.finest(() -> "Opening tdf file " + path.getAbsolutePath());
final long handle =
tdfLib.tims_open(path.getParentFile().getAbsolutePath(), useRecalibratedState);
logger.finest(() -> "File " + path.getName() + " hasReacalibratedState = "
+ tdfLib.tims_has_recalibrated_state(handle));
return handle;
} else {
+ logger.finest(() -> "Opening tdf path " + path.getAbsolutePath());
final long handle = tdfLib.tims_open(path.getAbsolutePath(), useRecalibratedState);
logger.finest(() -> "File " + path.getName() + " hasReacalibratedState = "
+ tdfLib.tims_has_recalibrated_state(handle));
