use newly introduced 'trace' level for logging of low-level file events to avoid spam in build.log if debug level is enabled

This commit is contained in:
nik
2015-11-24 13:54:02 +03:00
parent 32f2ed3e90
commit 8d4d476cf6
2 changed files with 22 additions and 22 deletions
@@ -30,7 +30,7 @@ import org.jetbrains.annotations.Nullable;
*/
public class IdeaWin32 {
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.util.io.win32.IdeaWin32");
private static final boolean DEBUG_ENABLED = LOG.isDebugEnabled();
private static final boolean TRACE_ENABLED = LOG.isTraceEnabled();
private static final IdeaWin32 ourInstance;
@@ -70,12 +70,12 @@ public class IdeaWin32 {
@Nullable
public FileInfo getInfo(@NotNull String path) {
path = path.replace('/', '\\');
if (DEBUG_ENABLED) {
LOG.debug("getInfo(" + path + ")");
if (TRACE_ENABLED) {
LOG.trace("getInfo(" + path + ")");
long t = System.nanoTime();
FileInfo result = getInfo0(path);
t = (System.nanoTime() - t) / 1000;
LOG.debug(" " + t + " mks");
LOG.trace(" " + t + " mks");
return result;
}
else {
@@ -86,12 +86,12 @@ public class IdeaWin32 {
@Nullable
public String resolveSymLink(@NotNull String path) {
path = path.replace('/', '\\');
if (DEBUG_ENABLED) {
LOG.debug("resolveSymLink(" + path + ")");
if (TRACE_ENABLED) {
LOG.trace("resolveSymLink(" + path + ")");
long t = System.nanoTime();
String result = resolveSymLink0(path);
t = (System.nanoTime() - t) / 1000;
LOG.debug(" " + t + " mks");
LOG.trace(" " + t + " mks");
return result;
}
else {
@@ -102,12 +102,12 @@ public class IdeaWin32 {
@Nullable
public FileInfo[] listChildren(@NotNull String path) {
path = path.replace('/', '\\');
if (DEBUG_ENABLED) {
LOG.debug("list(" + path + ")");
if (TRACE_ENABLED) {
LOG.trace("list(" + path + ")");
long t = System.nanoTime();
FileInfo[] children = listChildren0(path);
t = (System.nanoTime() - t) / 1000;
LOG.debug(" " + (children == null ? -1 : children.length) + " children, " + t + " mks");
LOG.trace(" " + (children == null ? -1 : children.length) + " children, " + t + " mks");
return children;
}
else {
@@ -38,15 +38,15 @@ class RandomAccessFileWithLengthAndSizeTracking extends RandomAccessFile {
mySize = super.length();
myPath = name;
if (LOG.isDebugEnabled()) {
LOG.debug("Inst:" + this + "," + Thread.currentThread() + "," + getClass().getClassLoader());
if (LOG.isTraceEnabled()) {
LOG.trace("Inst:" + this + "," + Thread.currentThread() + "," + getClass().getClassLoader());
}
}
@Override
public void seek(long pos) throws IOException {
if (LOG.isDebugEnabled()) {
LOG.debug("Seek:" + this + "," + Thread.currentThread() + "," + pos + "," + myPointer + "," + mySize);
if (LOG.isTraceEnabled()) {
LOG.trace("Seek:" + this + "," + Thread.currentThread() + "," + pos + "," + myPointer + "," + mySize);
}
if (doAssertions) {
checkSizeAndPointerAssertions();
@@ -87,8 +87,8 @@ class RandomAccessFileWithLengthAndSizeTracking extends RandomAccessFile {
@Override
public void write(byte[] b, int off, int len) throws IOException {
if (LOG.isDebugEnabled()) {
LOG.debug("write:" + this + "," + Thread.currentThread() + "," + len + "," + myPointer + "," + mySize);
if (LOG.isTraceEnabled()) {
LOG.trace("write:" + this + "," + Thread.currentThread() + "," + len + "," + myPointer + "," + mySize);
}
if (doAssertions) {
checkSizeAndPointerAssertions();
@@ -104,8 +104,8 @@ class RandomAccessFileWithLengthAndSizeTracking extends RandomAccessFile {
}
myPointer = pointer;
mySize = Math.max(pointer, mySize);
if (LOG.isDebugEnabled()) {
LOG.debug("after write:" + this + "," + Thread.currentThread() + "," + myPointer + "," + mySize );
if (LOG.isTraceEnabled()) {
LOG.trace("after write:" + this + "," + Thread.currentThread() + "," + myPointer + "," + mySize );
}
if (doAssertions) {
checkSizeAndPointerAssertions();
@@ -126,8 +126,8 @@ class RandomAccessFileWithLengthAndSizeTracking extends RandomAccessFile {
@Override
public int read(byte[] b, int off, int len) throws IOException {
if (LOG.isDebugEnabled()) {
LOG.debug("read:" + this + "," + Thread.currentThread() + "," + len + "," + myPointer );
if (LOG.isTraceEnabled()) {
LOG.trace("read:" + this + "," + Thread.currentThread() + "," + len + "," + myPointer );
}
if (doAssertions) {
checkSizeAndPointerAssertions();
@@ -175,8 +175,8 @@ class RandomAccessFileWithLengthAndSizeTracking extends RandomAccessFile {
@Override
public void close() throws IOException {
if (LOG.isDebugEnabled()) {
LOG.debug("Closed:" + this + "," + Thread.currentThread() );
if (LOG.isTraceEnabled()) {
LOG.trace("Closed:" + this + "," + Thread.currentThread() );
}
super.close();
}