X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.acorn%2Fsrc%2Forg%2Fsimantics%2Facorn%2FFileIO.java;h=8f3009afab3f82b84c23156775efd901a925c1ae;hb=1dfeb7d5c49b1391cd9d877e1eddab18995cb151;hp=c5480d86ec6c636233b5e5b21d8d5e688f319966;hpb=d42dba7176089fe102b0693337708c7c8304b86e;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.acorn/src/org/simantics/acorn/FileIO.java b/bundles/org.simantics.acorn/src/org/simantics/acorn/FileIO.java index c5480d86e..8f3009afa 100644 --- a/bundles/org.simantics.acorn/src/org/simantics/acorn/FileIO.java +++ b/bundles/org.simantics.acorn/src/org/simantics/acorn/FileIO.java @@ -19,9 +19,12 @@ import java.util.Map; import java.util.Set; import org.simantics.databoard.file.RuntimeIOException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class FileIO { - + + private static final Logger LOGGER = LoggerFactory.getLogger(FileIO.class); private static final FileAttribute[] NO_ATTRIBUTES = new FileAttribute[0]; private static final Set CREATE_OPTIONS = new HashSet<>(2); @@ -71,7 +74,7 @@ public class FileIO { if(TRACE_PERF) { long duration = System.nanoTime()-start; double ds = 1e-9*duration; - System.err.println("Wrote " + bytes.length + " bytes @ " + 1e-6*bytes.length / ds + "MB/s"); + LOGGER.info("Wrote " + bytes.length + " bytes @ " + 1e-6*bytes.length / ds + "MB/s"); } return result; } catch (Throwable t) { @@ -90,11 +93,11 @@ public class FileIO { } byte[] result = buf.array(); if (result.length != length) - System.err.println("faa"); + LOGGER.info("result length does not match expected {} {} {}", this, result.length, length); if (TRACE_PERF) { long duration = System.nanoTime() - start; double ds = 1e-9 * duration; - System.err.println("Read " + result.length + " bytes @ " + 1e-6 * result.length / ds + "MB/s"); + LOGGER.info("Read " + result.length + " bytes @ " + 1e-6 * result.length / ds + "MB/s"); } return result; } @@ -135,10 +138,10 @@ public class FileIO { syncPath(test); - long duration = System.nanoTime()-s; - System.err.println("Took " + 1e-6*duration + "ms."); - - + if (LOGGER.isDebugEnabled()) { + long duration = System.nanoTime()-s; + LOGGER.info("Took " + 1e-6*duration + "ms."); + } } }