Lazily evaluated debug statement

This commit is contained in:
Roman Shevchenko
2012-08-27 13:29:08 +04:00
parent 683ddb5b18
commit 0f4bfa0c07
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,6 +15,7 @@
*/
package com.intellij.openapi.diagnostic;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class LogUtil {
@@ -23,4 +24,13 @@ public class LogUtil {
public static String objectAndClass(@Nullable final Object o) {
return o != null ? o + " (" + o.getClass().getName() + ")" : "null";
}
/**
* Format string syntax as in {@linkplain String#format(String, Object...)}.
*/
public static void debug(@NotNull Logger logger, @NotNull String format, Object... args) {
if (logger.isDebugEnabled()) {
logger.debug(String.format(format, args));
}
}
}