本文整理匯總了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;
}
示例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));
}
示例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);
}
示例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();
}
示例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;
}
示例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;
}
}
示例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);
}
}
示例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());
}
示例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;
}
};
}