com.intellij.openapi.diagnostic.Logger.getInstance()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(153)

本文整理了Java中com.intellij.openapi.diagnostic.Logger.getInstance()方法的一些代码示例,展示了Logger.getInstance()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.getInstance()方法的具体详情如下:
包路径:com.intellij.openapi.diagnostic.Logger
类名称:Logger
方法名:getInstance

Logger.getInstance介绍

暂无

代码示例

代码示例来源:origin: KronicDeth/intellij-elixir

/**
 * Logs error to the {@code klass}'s {@link com.intellij.openapi.diagnostic.Logger} instance with the given
 * {@code userMessage} and the text of {@code element} as the details and containing file of {@code element} as an
 * attachment
 *
 * @param klass       Class whose logger to use
 * @param userMessage User message for
 *                    {@link com.intellij.diagnostic.LogMessageEx#createEvent(String, String, Attachment...)}
 * @param element     element responsible for the error
 */
public static void error(@NotNull Class klass, @NotNull String userMessage, PsiElement element) {
  error(com.intellij.openapi.diagnostic.Logger.getInstance(klass), userMessage, element);
}

代码示例来源:origin: KronicDeth/intellij-elixir

private static void error(@NotNull MacroNameArity macroNameArity) {
  com.intellij.openapi.diagnostic.Logger logger = com.intellij.openapi.diagnostic.Logger.getInstance(
      Decompiler.class
  );
  String fullUserMessage = "No decompiler for MacroNameArity (" + macroNameArity + ")";
  logger.error(
      LogMessageEx.createEvent(
          fullUserMessage,
          Joiner
              .on("\n")
              .join(
                  new Throwable().getStackTrace()
              ),
          fullUserMessage,
          null,
          Collections.<Attachment>emptyList()
      )
  );
}

代码示例来源:origin: KronicDeth/intellij-elixir

private void renderObject(@NotNull LookupElement lookupElement) {
  Logger logger = Logger.getInstance(CallDefinitionClause.class);
  Object object = lookupElement.getObject();
  String userMessage = "CallDefinitionClause render called on LookupElement with null getPsiElement\n" +

代码示例来源:origin: KronicDeth/intellij-elixir

public abstract class ModuleElementImpl extends PsiElementBase implements PsiCompiledElement {
  public static final Key<PsiCompiledElement> COMPILED_ELEMENT = Key.create("COMPILED_ELEMENT");
  private static final Logger LOGGER = Logger.getInstance(ModuleElementImpl.class);

代码示例来源:origin: go-lang-plugin-org/go-lang-idea-plugin

return ((GoNamedElement)element).getName() + typeText;
Logger.getInstance(GoStructureViewFactory.class).error("Cannot get presentation for " + element.getClass().getName());
return null;

代码示例来源:origin: go-lang-plugin-org/go-lang-idea-plugin

public boolean execute() {
 Logger.getInstance(getClass()).assertTrue(!ApplicationManager.getApplication().isDispatchThread(),
                      "It's bad idea to run external tool on EDT");
 Logger.getInstance(getClass()).assertTrue(myProcessHandler == null, "Process has already run with this executor instance");
 Ref<Boolean> result = Ref.create(false);
 GeneralCommandLine commandLine = null;

代码示例来源:origin: ballerina-platform/ballerina-lang

public boolean execute() {
  Logger.getInstance(getClass()).assertTrue(!ApplicationManager.getApplication().isDispatchThread(),
      "It's bad idea to run external tool on EDT");
  Logger.getInstance(getClass()).assertTrue(myProcessHandler == null,
      "Process has already run with this executor instance");
  Ref<Boolean> result = Ref.create(false);

代码示例来源:origin: winterDroid/android-drawable-importer-intellij-plugin

return img;
} catch (Exception e) {
  Logger.getInstance(ImageUtils.class).error("resizeBorder", e);

代码示例来源:origin: JetBrains/jediterm

@NotNull
public static Logger getInstance(@NotNull Class cl) {
 return getInstance("#" + cl.getName());
}

代码示例来源:origin: JetBrains/jediterm

@SuppressWarnings("UnusedDeclaration")
public void callback(ID self, Pointer selector, ID event) {
 Logger.getInstance(MacScrollBarUI.class).debug("update scroll bar");
 UIUtil.invokeLaterIfNeeded(this);
}

代码示例来源:origin: JetBrains/jediterm

public Native() {
 Logger.getInstance(MacScrollBarUI.class).debug("initialize scroll bar");
 UIUtil.invokeLaterIfNeeded(this);
}

代码示例来源:origin: JetBrains/jediterm

@Nullable
 @Override
 public Style produce() {
  ID style = invoke(getObjcClass("NSScroller"), "preferredScrollerStyle");
  Style value = 1 == style.intValue() ? Overlay : Legacy;
  Logger.getInstance(MacScrollBarUI.class).debug("scroll bar style ", value, " from ", style);
  return value;
 }
};

代码示例来源:origin: intellij-dlanguage/intellij-dlanguage

default Set<NamedStubBase> getMembers() {
  final Set<NamedStubBase> res = new HashSet<>();
  ((DlangFile) getContainingFile()).calcStubTree();
  final StubElement greenStub = ((StubBasedPsiElementBase) this).getGreenStub();
  if (greenStub == null) {
    Logger.getInstance(this.getClass())
      .warn("Green stub was null for file:" + getContainingFile());
    return Collections.emptySet();
  }
  getMembersImpl(greenStub, res);
  return res;
}

代码示例来源:origin: intellij-dlanguage/intellij-dlanguage

private static Annotation createAnnotation(@NotNull final AnnotationHolderImpl holder, @NotNull final HighlightSeverity severity, @NotNull final TextRange range, @Nullable final String message) {
  final String tooltip = message == null ? null : XmlStringUtil.wrapInHtml(escapeSpacesForHtml(XmlStringUtil.escapeString(message)));
  final Annotation annotation;
  try {
    annotation = new Annotation(range.getStartOffset(), range.getEndOffset(), severity,
      message, tooltip);
  } catch (final AssertionError e) {
    Logger.getInstance(DAnnotationHolder.class).warn(
      "Could not create annotation. Most likely caused by someone/typing/deleting the applicable range:"
        + e);
    return null;
  }
  holder.add(annotation);
  return annotation;
}

代码示例来源:origin: JetBrains/jediterm

@Nullable
 @Override
 public Behavior produce() {
  ID defaults = invoke("NSUserDefaults", "standardUserDefaults");
  invoke(defaults, "synchronize");
  ID behavior = invoke(defaults, "boolForKey:", nsString("AppleScrollerPagingBehavior"));
  Behavior value = 1 == behavior.intValue() ? JumpToSpot : NextPage;
  Logger.getInstance(MacScrollBarUI.class).debug("scroll bar behavior ", value, " from ", behavior);
  return value;
 }
};

代码示例来源:origin: JetBrains/jediterm

private static <T> T callMac(Producer<T> producer) {
 if (SystemInfo.isMac) {
  NSAutoreleasePool pool = new NSAutoreleasePool();
  try {
   return producer.produce();
  }
  catch (Throwable throwable) {
   Logger.getInstance(MacScrollBarUI.class).warn(throwable);
  }
  finally {
   pool.drain();
  }
 }
 return null;
}

代码示例来源:origin: antlr/intellij-plugin-v4

private static void exportToSvg(UberTreeViewer parseTreeViewer, File file, boolean useTransparentBackground) {
    DOMImplementation domImpl = GenericDOMImplementation.getDOMImplementation();
    Document document = domImpl.createDocument("http://www.w3.org/2000/svg", "svg", null);
    SVGGraphics2D svgGenerator = new SVGGraphics2D(document);

    if (!useTransparentBackground) {
      svgGenerator.setColor(JBColor.WHITE);
      svgGenerator.fillRect(0, 0, parseTreeViewer.getWidth(), parseTreeViewer.getHeight());
    }
    parseTreeViewer.paint(svgGenerator);

    try {
      svgGenerator.stream(file.getAbsolutePath(), true);
    } catch (SVGGraphics2DIOException e) {
      Logger.getInstance(ParseTreeContextualMenu.class).error("Error while exporting parse tree to SVG file " + file.getAbsolutePath(), e);
    }
  }
}

代码示例来源:origin: intellij-dlanguage/intellij-dlanguage

@NotNull
@Override
public String getImportedModuleName() {
  if (getGreenStub() != null) {
    return getGreenStub().getImportedModule();
  }
  if (getIdentifierChain() == null) {
    return DReference.Companion.getNAME_NOT_FOUND_STRING();
  }
  if (getIdentifierChain().getText().equals("")) {
    Logger.getInstance(getClass())
      .warn("getIdentifier chain was: \"\". Complete text of symbol: " + getText());
    return DReference.Companion.getNAME_NOT_FOUND_STRING();
  }
  return getIdentifierChain().getText();
}

代码示例来源:origin: intellij-dlanguage/intellij-dlanguage

@Nullable
  @Override
  protected RunContentDescriptor doExecute(RunProfileState state, ExecutionEnvironment env) throws ExecutionException {
    if (env.getExecutor().getActionName().equals(DefaultDebugExecutor.EXECUTOR_ID)) {
      Project project = env.getProject();

      Executor executor = env.getExecutor();
      Logger logger = Logger.getInstance(this.getClass());
      try {
        return RunUtil.startDebugger(this, state, env, project, executor, ((DlangRunAppState) state).getExecutableCommandLine(((DlangRunAppState) state).getConfig()).getExePath());//todo this is yucky
      } catch (ModuleNotFoundException e) {
        e.printStackTrace();
        logger.error(e.toString());
      } catch (NoValidDlangSdkFound NoValidDlangSdkFound) {
        NoValidDlangSdkFound.printStackTrace();
        logger.error(NoValidDlangSdkFound.toString());
      }
    }
    return super.doExecute(state, env);
  }
}

代码示例来源:origin: dhleong/intellivim

private static String extractDescription(HighlightInfo.IntentionActionDescriptor descriptor) {
  try {
    if (!StringUtil.isEmpty(descriptor.getDisplayName())) {
      return descriptor.getDisplayName();
    } else if (!StringUtil.isEmpty(safelyGetActionText(descriptor))) {
      return descriptor.getAction().getText();
    } else if (!StringUtil.isEmpty(safelyGetFamilyName(descriptor))) {
      return descriptor.getAction().getFamilyName();
    } else {
      return descriptor.getAction().getClass().getSimpleName();
    }
  } catch (Exception e) {
    Logger.getInstance(QuickFixDescriptor.class).warn("Problem extracting description", e);
    return "";
  }
}

相关文章