List of usage examples for com.intellij.openapi.diagnostic IdeaLoggingEvent IdeaLoggingEvent
public IdeaLoggingEvent(String message, Throwable throwable)
From source file:bazaar4idea.util.BzrErrorReportSubmitter.java
License:Apache License
@SuppressWarnings({ "ThrowableInstanceNeverThrown" })
public static void main(String[] args) throws Exception {
Exception e = new Exception("test exception");
IdeaLoggingEvent ev = new IdeaLoggingEvent("a test exception occurred", e);
BzrErrorReportSubmitter submitter = new BzrErrorReportSubmitter();
SubmittedReportInfo reportInfo = submitter.submit(new IdeaLoggingEvent[] { ev }, null);
System.out.printf("url: \"%s\"\nlinkText: \"%s\"\nstatus: \"%s\"\n", reportInfo.getURL(),
reportInfo.getLinkText(), reportInfo.getStatus());
}
From source file:com.intellij.diagnostic.DialogAppender.java
License:Apache License
private static IdeaLoggingEvent extractLoggingEvent(Object message, Throwable throwable) { //noinspection ThrowableResultOfMethodCallIgnored Throwable rootCause = ExceptionUtil.getRootCause(throwable); if (rootCause instanceof LogEventException) { return ((LogEventException) rootCause).getLogMessage(); }/*from w w w. j ava2s . c om*/ String strMessage = message == null ? "<null> " : message.toString(); ExceptionWithAttachments withAttachments = ExceptionUtil.findCause(throwable, ExceptionWithAttachments.class); if (withAttachments != null) { return LogMessageEx.createEvent(strMessage, ExceptionUtil.getThrowableText(throwable), withAttachments.getAttachments()); } return new IdeaLoggingEvent(strMessage, throwable); }
From source file:com.intellij.diagnostic.LogMessageEx.java
License:Apache License
/** * @param userMessage user-friendly message description (short, single line if possible) * @param details technical details (exception stack trace etc.) * @param title text to show in Event Log tool window entry (it comes before 'more'), use <code>null</code> to reuse <code>userMessage</code> * @param notificationText text to show in the error balloon that is popped up automatically. Default is <code>com.intellij.diagnostic.IdeMessagePanel#INTERNAL_ERROR_NOTICE</code> * @param attachments attachments that will be suggested to include to the report * @return/*ww w . j ava2 s .com*/ */ public static IdeaLoggingEvent createEvent(final String userMessage, final String details, @Nullable final String title, @Nullable final String notificationText, final Collection<Attachment> attachments) { final Throwable throwable = new Throwable() { @Override public void printStackTrace(PrintWriter s) { s.print(details); } @Override public void printStackTrace(PrintStream s) { s.print(details); } }; return new IdeaLoggingEvent(userMessage, throwable) { @Override public Object getData() { final LogMessageEx logMessageEx = new LogMessageEx(this, title != null ? title : userMessage, notificationText); for (Attachment attachment : attachments) { logMessageEx.addAttachment(attachment); } return logMessageEx; } }; }