當前位置: 首頁>>代碼示例>>Java>>正文


Java Logger.warn方法代碼示例

本文整理匯總了Java中com.intellij.openapi.diagnostic.Logger.warn方法的典型用法代碼示例。如果您正苦於以下問題:Java Logger.warn方法的具體用法?Java Logger.warn怎麽用?Java Logger.warn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.openapi.diagnostic.Logger的用法示例。


在下文中一共展示了Logger.warn方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getBinary

import com.intellij.openapi.diagnostic.Logger; //導入方法依賴的package包/類
@NotNull
public static String getBinary(String envVar, String propVar, @NotNull String defaultBinary) {
    Logger log = Logger.getInstance("ReasonML");
    log.info("Identifying '" + defaultBinary + "' binary");

    String binary = System.getProperty(propVar);
    if (binary != null) {
        log.info("Found '" + binary + "' in the property '" + propVar + "'");
        return binary;
    }

    log.info("Property '" + envVar + "' not found, testing environment variable '" + propVar + "'");
    binary = System.getenv(envVar);
    if (binary != null) {
        log.info("Found '" + binary + "' in the environment variable '" + envVar + "'");
        return binary;
    }

    log.warn("No '" + defaultBinary + "' found in environment or properties, use default one");
    return defaultBinary;
}
 
開發者ID:reasonml-editor,項目名稱:reasonml-idea-plugin,代碼行數:22,代碼來源:Platform.java

示例2: log

import com.intellij.openapi.diagnostic.Logger; //導入方法依賴的package包/類
public static void log(Logger logger, String title, String details, NotificationType level) {
    switch (level) {
        case ERROR:
            logger.error(title, details);
            break;
        case WARNING:
            logger.warn(title + "\n" + details);
            break;
        default:
            logger.info(title + "\n" + details);
    }
    if (StringUtils.isBlank(details)) {
        details = title;
    }
    Notifications.Bus.notify(EVENT_LOG_NOTIFIER.createNotification(title, details, level, null));
}
 
開發者ID:JFrogDev,項目名稱:jfrog-idea-plugin,代碼行數:17,代碼來源:Utils.java

示例3: getEnvironmentToRerun

import com.intellij.openapi.diagnostic.Logger; //導入方法依賴的package包/類
@Nullable
@Override
protected ExecutionEnvironment getEnvironmentToRerun(@NotNull final RunContentDescriptor lastRunDescriptor) {
  if (myTimesToRerunFailedTests == myCurrentRerunStep) {
    return null;
  }

  final Logger logger = Logger.getInstance(PyAbstractTestProcessRunner.class);
  if (getFailedTestsCount() == 0) {
    logger
      .warn(String.format("No failed tests on iteration %d, not sure what to rerun", myCurrentRerunStep));
  }
  logger.info(String.format("Starting iteration %s", myCurrentRerunStep));

  myCurrentRerunStep++;

  return RerunFailedActionsTestTools.findRestartAction(lastRunDescriptor);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:19,代碼來源:PyAbstractTestProcessRunner.java

示例4: load

import com.intellij.openapi.diagnostic.Logger; //導入方法依賴的package包/類
@Nullable
@Override
public Optional<Icon> load(@NotNull File key) {
  Logger log = Logger.getInstance(ActivityGalleryStep.class);
  try {
    if (key.isFile()) {
      BufferedImage image = ImageIO.read(key);
      if (image != null) {
        return Optional.<Icon>of(new ImageIcon(image.getScaledInstance(256, 256, Image.SCALE_SMOOTH)));
      }
      else {
        log.error("File " + key.getAbsolutePath() + " exists but is not a valid image");
      }
    }
    else {
      log.error("Image file " + key.getAbsolutePath() + " was not found");
    }
  }
  catch (IOException e) {
    log.warn(e);
  }
  return Optional.absent();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:24,代碼來源:TemplateParameterStep2.java

示例5: validateNotNull

import com.intellij.openapi.diagnostic.Logger; //導入方法依賴的package包/類
private boolean validateNotNull(
    @NotNull final String problem,
    @Nullable final String subj,
    @NotNull final Logger logger
) {
    boolean isValid = true;
    if (subj == null || subj.isEmpty()) {
        logger.warn(problem + ": " + this);
        isValid = false;
    }
    return isValid;
}
 
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:13,代碼來源:XmlRuleParser.java

示例6: connect

import com.intellij.openapi.diagnostic.Logger; //導入方法依賴的package包/類
public <T> T connect(@NotNull HttpRequests.RequestProcessor<T> processor, T errorValue, @Nullable Logger logger) {
  try {
    return connect(processor);
  }
  catch (Throwable e) {
    if (logger != null) {
      logger.warn(e);
    }
    return errorValue;
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:12,代碼來源:RequestBuilder.java

示例7: logProblem

import com.intellij.openapi.diagnostic.Logger; //導入方法依賴的package包/類
public static void logProblem(final Logger log, final String msg, boolean throwError, final String testFrameworkName) {
  final String text = getTFrameworkPrefix(testFrameworkName) + msg;
  if (throwError) {
    log.error(text);
  }
  else {
    log.warn(text);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:GeneralTestEventsProcessor.java

示例8: testLinks

import com.intellij.openapi.diagnostic.Logger; //導入方法依賴的package包/類
@Test
public void testLinks() throws java.io.IOException {
  final String s =
    StreamUtil.readText(PyTestTracebackParserTest.class.getResource("linksDataTest.txt").openStream(), Charset.defaultCharset());

  final Set<String> requiredStrings = new HashSet<String>();
  requiredStrings.add("file:///c:/windows/system32/file.txt - 42");
  requiredStrings.add("file:///c:/windows/system32/file_spam.txt - 42");
  requiredStrings.add("c:\\documents and settings\\foo.txt - 43");
  requiredStrings.add("file:///c:/windows/system32/file.txt - 42");
  requiredStrings.add("/file.py - 42");
  requiredStrings.add("c:\\folder55\\file.py - 12");
  requiredStrings.add("C:\\temp\\untitled55\\test_sample.py - 5");
  requiredStrings.add("C:\\temp\\untitled55\\test_sample.py - 6");
  requiredStrings.add("C:\\temp\\untitled55\\test_sample.py - 7");
  requiredStrings.add("C:\\temp\\untitled55\\test_sample.py - 89999");
  requiredStrings.add("C:\\temp\\untitled55\\test_sample.py - 99999");
  requiredStrings.add("../../../files/files.py - 100");
  requiredStrings.add("/Users/Mac Hipster/Applications/PyCharm 4.0 .app/helpers/lala.py - 12");
  requiredStrings.add("C:\\Users\\ilya.kazakevich\\virtenvs\\spammy\\lib\\site-packages\\django_cron\\models.py - 4");
  final Logger logger = Logger.getInstance(PyTestTracebackParserTest.class);
  final String[] strings = s.split("\n");
  logger.warn(String.format("Got lines %s", strings));
  for (final String line : strings) {
    logger.warn(String.format("Starting with string %s", line));
    final LinkInTrace trace = new PyTestTracebackParser().findLinkInTrace(line);
    logger.warn(String.format("Got %s", trace));
    if (trace != null) {
      final boolean removeResult = requiredStrings.remove(trace.getFileName() + " - " + trace.getLineNumber());
      Assert.assertTrue(String.format("Unexpected file found %s line %s", trace.getFileName(), trace.getLineNumber()),
                        removeResult);
    }
  }
  Assert.assertThat("Some lines were not found", requiredStrings, Matchers.empty());
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:36,代碼來源:PyTestTracebackParserTest.java

示例9: RareLogger

import com.intellij.openapi.diagnostic.Logger; //導入方法依賴的package包/類
private RareLogger(final Logger logger, final boolean fairSynch) {
  myLogger = logger;

  final Object lock = new Object();
  myCache = new SLRUMap<Object, Long>(64, 32) {
    @Override
    public Long get(Object key) {
      if (fairSynch) {
        synchronized (lock) {
          return super.get(key);
        }
      }
      return super.get(key);
    }

    @Override
    public void put(Object key, @NotNull Long value) {
      if (fairSynch) {
        synchronized (lock) {
          super.put(key, value);
          return;
        }
      }
      super.put(key, value);
    }

    @Override
    public boolean remove(Object key) {
      if (fairSynch) {
        synchronized (lock) {
          return super.remove(key);
        }
      }
      return super.remove(key);
    }
  };
  myConvertors = new LinkedList<LogFilter>();

  // just passes to parent logger
  myProxy = new LogFilter() {
    @Override
    @NotNull
    public Integer getAllowedLoggingInterval(Level level, String message, Throwable t, String[] details) {
      return -1;
    }
    @Override
    public Object getKey(@NotNull Level level,
                         @NonNls String message,
                         @Nullable Throwable t,
                         @NonNls String... details) {
      if (Level.DEBUG.equals(level)) {
        logger.debug(message, t);
      } else if (Level.INFO.equals(level)) {
        logger.info(message, t);
      } else if (Level.WARN.equals(level)) {
        logger.warn(message, t);
      } else if (Level.ERROR.equals(level)) {
        logger.error(message, t, details);
      }
      return null;
    }
  };
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:64,代碼來源:RareLogger.java


注:本文中的com.intellij.openapi.diagnostic.Logger.warn方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。