Commit fb0a5e6c authored by Alexandr Evstigneev's avatar Alexandr Evstigneev
Browse files

Introduced debug methods for computable messages

To avoid heavy computations in `debug` statements we now need to pollute code with explicit checking for `isDebugEnabled()`

IDEA-CR-38619

(cherry picked from commit 895497f2)

(cherry picked from commit 597031fe)
parent 0ad48890
Branches unavailable Tags unavailable
No related merge requests found
Showing with 13 additions and 0 deletions
+13 -0
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.diagnostic;
import com.intellij.openapi.util.Computable;
import com.intellij.util.ArrayUtil;
import com.intellij.util.ExceptionUtil;
import com.intellij.util.Function;
......@@ -81,10 +82,22 @@ public abstract class Logger {
public abstract void debug(String message);
public final void debug(@NotNull Computable<String> messageComputable) {
if (isDebugEnabled()) {
debug(messageComputable.compute());
}
}
public abstract void debug(@Nullable Throwable t);
public abstract void debug(String message, @Nullable Throwable t);
public final void debug(@NotNull Computable<String> messageComputable, @Nullable Throwable t) {
if (isDebugEnabled()) {
debug(messageComputable.compute(), t);
}
}
public void debug(@NotNull String message, @NotNull Object... details) {
if (isDebugEnabled()) {
StringBuilder sb = new StringBuilder();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment