Search in sources :

Example 1 with Logger

use of com.intellij.openapi.diagnostic.Logger in project intellij-community by JetBrains.

the class PyStdlibUtil method loadStdlibPackagesList.

@Nullable
private static Set<String> loadStdlibPackagesList() {
    final Logger log = Logger.getInstance(PyStdlibUtil.class.getName());
    final String helperPath = PythonHelpersLocator.getHelperPath("/tools/stdlib_packages.txt");
    try {
        final BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(helperPath)));
        try {
            final Set<String> result = new HashSet<>();
            String line;
            while ((line = reader.readLine()) != null) {
                result.add(line);
            }
            return result;
        } finally {
            reader.close();
        }
    } catch (IOException e) {
        log.error("Cannot read list of standard library packages: " + e.getMessage());
    }
    return null;
}
Also used : InputStreamReader(java.io.InputStreamReader) BufferedReader(java.io.BufferedReader) IOException(java.io.IOException) Logger(com.intellij.openapi.diagnostic.Logger) FileInputStream(java.io.FileInputStream) HashSet(java.util.HashSet) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with Logger

use of com.intellij.openapi.diagnostic.Logger in project intellij-community by JetBrains.

the class PyAbstractTestProcessRunner method getEnvironmentToRerun.

@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);
}
Also used : Logger(com.intellij.openapi.diagnostic.Logger) Nullable(org.jetbrains.annotations.Nullable)

Example 3 with Logger

use of com.intellij.openapi.diagnostic.Logger in project intellij-community by JetBrains.

the class UnsupportedFeaturesUtil method fillTestCaseMethods.

private static void fillTestCaseMethods() throws IOException {
    final Logger log = Logger.getInstance(UnsupportedFeaturesUtil.class.getName());
    final FileReader reader = new FileReader(PythonHelpersLocator.getHelperPath("/tools/class_method_versions.xml"));
    try {
        final XMLReader xr = XMLReaderFactory.createXMLReader();
        final ClassMethodsParser parser = new ClassMethodsParser();
        xr.setContentHandler(parser);
        xr.parse(new InputSource(reader));
    } catch (SAXException e) {
        log.error("Improperly formed \"class_method_versions.xml\". " + e.getMessage());
    } finally {
        reader.close();
    }
}
Also used : InputSource(org.xml.sax.InputSource) FileReader(java.io.FileReader) Logger(com.intellij.openapi.diagnostic.Logger) XMLReader(org.xml.sax.XMLReader) SAXException(org.xml.sax.SAXException)

Example 4 with Logger

use of com.intellij.openapi.diagnostic.Logger in project intellij-community by JetBrains.

the class ReplacerUtil method copySpacesAndCommentsBefore.

public static PsiElement copySpacesAndCommentsBefore(PsiElement elementToReplace, PsiElement[] patternElements, String replacementToMake, PsiElement elementParent) {
    int i = 0;
    while (true) {
        // if it goes out of bounds then deep error happens
        if (!(patternElements[i] instanceof PsiComment || patternElements[i] instanceof PsiWhiteSpace)) {
            break;
        }
        ++i;
        if (patternElements.length == i) {
            break;
        }
    }
    if (patternElements.length == i) {
        Logger logger = Logger.getInstance(StructuralSearchProfile.class.getName());
        logger.error("Unexpected replacement structure:" + replacementToMake);
    }
    if (i != 0) {
        elementParent.addRangeBefore(patternElements[0], patternElements[i - 1], elementToReplace);
    }
    return patternElements[i];
}
Also used : PsiComment(com.intellij.psi.PsiComment) StructuralSearchProfile(com.intellij.structuralsearch.StructuralSearchProfile) Logger(com.intellij.openapi.diagnostic.Logger) PsiWhiteSpace(com.intellij.psi.PsiWhiteSpace)

Example 5 with Logger

use of com.intellij.openapi.diagnostic.Logger in project intellij-community by JetBrains.

the class TestLoggerFactory method enableDebugLogging.

public static void enableDebugLogging(@NotNull Disposable parentDisposable, @NotNull String... categories) {
    for (String category : categories) {
        final Logger logger = Logger.getInstance(category);
        logger.setLevel(Level.DEBUG);
        Disposer.register(parentDisposable, () -> logger.setLevel(Level.INFO));
    }
}
Also used : Logger(com.intellij.openapi.diagnostic.Logger)

Aggregations

Logger (com.intellij.openapi.diagnostic.Logger)17 Nullable (org.jetbrains.annotations.Nullable)5 File (java.io.File)3 StringUtil (com.intellij.openapi.util.text.StringUtil)2 IOException (java.io.IOException)2 java.util (java.util)2 NotNull (org.jetbrains.annotations.NotNull)2 SdkConstants (com.android.SdkConstants)1 VisibleForTesting (com.android.annotations.VisibleForTesting)1 CollectingOutputReceiver (com.android.ddmlib.CollectingOutputReceiver)1 LayoutLog (com.android.ide.common.rendering.api.LayoutLog)1 TAG_RESOURCES_PREFIX (com.android.ide.common.rendering.api.LayoutLog.TAG_RESOURCES_PREFIX)1 TAG_RESOURCES_RESOLVE_THEME_ATTR (com.android.ide.common.rendering.api.LayoutLog.TAG_RESOURCES_RESOLVE_THEME_ATTR)1 ResourceResolver (com.android.ide.common.resources.ResourceResolver)1 RenderSessionImpl (com.android.layoutlib.bridge.impl.RenderSessionImpl)1 Density (com.android.resources.Density)1 IAndroidTarget (com.android.sdklib.IAndroidTarget)1 AndroidModuleInfo (com.android.tools.idea.model.AndroidModuleInfo)1 TAG_STILL_BUILDING (com.android.tools.idea.rendering.RenderLogger.TAG_STILL_BUILDING)1 RenderErrorModel (com.android.tools.idea.rendering.errors.ui.RenderErrorModel)1