本文整理匯總了Java中com.intellij.openapi.diagnostic.Logger.isDebugEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java Logger.isDebugEnabled方法的具體用法?Java Logger.isDebugEnabled怎麽用?Java Logger.isDebugEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.openapi.diagnostic.Logger
的用法示例。
在下文中一共展示了Logger.isDebugEnabled方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: prettyFormatResponseToLog
import com.intellij.openapi.diagnostic.Logger; //導入方法依賴的package包/類
public static void prettyFormatResponseToLog(@NotNull Logger logger, @NotNull HttpResponse response) {
if (logger.isDebugEnabled()) {
try {
String content = TaskResponseUtil.getResponseContentAsString(response);
org.apache.http.Header header = response.getEntity().getContentType();
String contentType = header == null ? "text/plain" : header.getElements()[0].getName().toLowerCase(Locale.ENGLISH);
if (contentType.contains("xml")) {
prettyFormatXmlToLog(logger, content);
}
else if (contentType.contains("json")) {
prettyFormatJsonToLog(logger, content);
}
else {
logger.debug(content);
}
}
catch (IOException e) {
logger.error(e);
}
}
}
示例2: getPlatformNotifier
import com.intellij.openapi.diagnostic.Logger; //導入方法依賴的package包/類
private static Notifier getPlatformNotifier() {
try {
if (SystemInfo.isMac) {
if (SystemInfo.isMacOSMountainLion && Registry.is("ide.mac.mountain.lion.notifications.enabled")) {
return MountainLionNotifications.getInstance();
}
if (!Boolean.getBoolean("growl.disable")) {
return GrowlNotifications.getInstance();
}
}
if (SystemInfo.isXWindow && Registry.is("ide.libnotify.enabled") ) {
return LibNotifyWrapper.getInstance();
}
}
catch (Throwable t) {
Logger logger = Logger.getInstance(SystemNotifications.class);
if (logger.isDebugEnabled()) {
logger.debug(t);
}
else {
logger.info(t.getMessage());
}
}
return null;
}
示例3: prettyFormatXmlToLog
import com.intellij.openapi.diagnostic.Logger; //導入方法依賴的package包/類
/**
* Print pretty-formatted XML to {@code logger}, if its level is DEBUG or below.
*/
public static void prettyFormatXmlToLog(@NotNull Logger logger, @NotNull Element element) {
if (logger.isDebugEnabled()) {
// alternatively
//new XMLOutputter(Format.getPrettyFormat()).outputString(root)
logger.debug("\n" + JDOMUtil.createOutputter("\n").outputString(element));
}
}
示例4: prettyFormatJsonToLog
import com.intellij.openapi.diagnostic.Logger; //導入方法依賴的package包/類
/**
* Parse and print pretty-formatted Json to {@code logger}, if its level is DEBUG or below.
*/
public static void prettyFormatJsonToLog(@NotNull Logger logger, @NotNull String json) {
if (logger.isDebugEnabled()) {
try {
Gson gson = new GsonBuilder().setPrettyPrinting().create();
logger.debug("\n" + gson.toJson(gson.fromJson(json, JsonElement.class)));
}
catch (JsonSyntaxException e) {
logger.debug("Malformed JSON\n" + json);
}
}
}
示例5: log
import com.intellij.openapi.diagnostic.Logger; //導入方法依賴的package包/類
private static void log(String format, Object... args) {
Logger logger = Logger.getInstance(SocketLock.class);
if (logger.isDebugEnabled()) {
logger.debug(String.format(format, args));
}
}