本文整理汇总了Java中com.intellij.openapi.diagnostic.IdeaLoggingEvent类的典型用法代码示例。如果您正苦于以下问题:Java IdeaLoggingEvent类的具体用法?Java IdeaLoggingEvent怎么用?Java IdeaLoggingEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IdeaLoggingEvent类属于com.intellij.openapi.diagnostic包,在下文中一共展示了IdeaLoggingEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: log
import com.intellij.openapi.diagnostic.IdeaLoggingEvent; //导入依赖的package包/类
private void log(@NotNull IdeaLoggingEvent[] events, @Nullable String additionalInfo) {
IdeaLoggingEvent ideaEvent = events[0];
if (ideaEvent.getThrowable() == null) {
return;
}
LinkedHashMap<String, Object> customData = new LinkedHashMap<>();
customData.put(TAG_PLATFORM_VERSION, ApplicationInfo.getInstance().getBuild().asString());
customData.put(TAG_OS, SystemInfo.OS_NAME);
customData.put(TAG_OS_VERSION, SystemInfo.OS_VERSION);
customData.put(TAG_OS_ARCH, SystemInfo.OS_ARCH);
customData.put(TAG_JAVA_VERSION, SystemInfo.JAVA_VERSION);
customData.put(TAG_JAVA_RUNTIME_VERSION, SystemInfo.JAVA_RUNTIME_VERSION);
if (additionalInfo != null) {
customData.put(EXTRA_ADDITIONAL_INFO, additionalInfo);
}
if (events.length > 1) {
customData.put(EXTRA_MORE_EVENTS,
Stream.of(events).map(Object::toString).collect(Collectors.joining("\n")));
}
rollbar.codeVersion(getPluginVersion()).log(ideaEvent.getThrowable(), customData);
}
示例2: createEvent
import com.intellij.openapi.diagnostic.IdeaLoggingEvent; //导入依赖的package包/类
@NotNull
private EventBuilder createEvent(@NotNull IdeaLoggingEvent[] events, @Nullable String additionalInfo) {
IdeaLoggingEvent ideaEvent = events[0];
EventBuilder eventBuilder = new EventBuilder();
eventBuilder.withMessage(ideaEvent.getMessage());
eventBuilder.withRelease(getPluginVersion());
eventBuilder.withTag(TAG_PLATFORM_VERSION, getPlatformVersion());
eventBuilder.withTag(TAG_OS, SystemInfo.OS_NAME);
eventBuilder.withTag(TAG_OS_VERSION, SystemInfo.OS_VERSION);
eventBuilder.withTag(TAG_OS_ARCH, SystemInfo.OS_ARCH);
eventBuilder.withTag(TAG_JAVA_VERSION, SystemInfo.JAVA_VERSION);
eventBuilder.withTag(TAG_JAVA_RUNTIME_VERSION, SystemInfo.JAVA_RUNTIME_VERSION);
if (ideaEvent.getThrowable() != null) {
eventBuilder.withSentryInterface(new ExceptionInterface(ideaEvent.getThrowable()));
}
if (additionalInfo != null) {
eventBuilder.withExtra(EXTRA_ADDITIONAL_INFO, additionalInfo);
}
if (events.length > 1) {
eventBuilder.withExtra(EXTRA_MORE_EVENTS, getMoreEvents(events));
}
eventBuilder.withExtra(EXTRA_OTHER_PLUGINS, getOtherPluginsInfo());
return eventBuilder;
}
示例3: addIdeFatalMessage
import com.intellij.openapi.diagnostic.IdeaLoggingEvent; //导入依赖的package包/类
@Nullable
public LogMessage addIdeFatalMessage(final IdeaLoggingEvent aEvent) {
Object data = aEvent.getData();
final LogMessage message = data instanceof LogMessage ? (LogMessage)data : new LogMessage(aEvent);
if (myIdeFatals.size() < MAX_POOL_SIZE_FOR_FATALS) {
if (myFatalsGrouper.addToGroup(message)) {
return message;
}
} else if (myIdeFatals.size() == MAX_POOL_SIZE_FOR_FATALS) {
String msg = DiagnosticBundle.message("error.monitor.too.many.errors");
LogMessage tooMany = new LogMessage(new LoggingEvent(msg, Category.getRoot(), Priority.ERROR, null, new TooManyErrorsException()));
myFatalsGrouper.addToGroup(tooMany);
return tooMany;
}
return null;
}
示例4: canHandle
import com.intellij.openapi.diagnostic.IdeaLoggingEvent; //导入依赖的package包/类
public boolean canHandle(IdeaLoggingEvent event) {
if (ourLoggerBroken) return false;
try {
UpdateChecker.checkForUpdate(event);
boolean notificationEnabled = !DISABLED_VALUE.equals(System.getProperty(FATAL_ERROR_NOTIFICATION_PROPERTY, ENABLED_VALUE));
ErrorReportSubmitter submitter = IdeErrorsDialog.getSubmitter(event.getThrowable());
boolean showPluginError = !(submitter instanceof ITNReporter) || ((ITNReporter)submitter).showErrorInRelease(event);
//noinspection ThrowableResultOfMethodCallIgnored
return notificationEnabled ||
showPluginError ||
ApplicationManagerEx.getApplicationEx().isInternal() ||
isOOMError(event.getThrowable()) ||
event.getThrowable() instanceof MappingFailedException;
}
catch (LinkageError e) {
if (e.getMessage().contains("Could not initialize class com.intellij.diagnostic.IdeErrorsDialog")) {
//noinspection AssignmentToStaticFieldFromInstanceMethod
ourLoggerBroken = true;
}
throw e;
}
}
示例5: configureErrorFromEvent
import com.intellij.openapi.diagnostic.IdeaLoggingEvent; //导入依赖的package包/类
private static void configureErrorFromEvent(IdeaLoggingEvent event, ErrorBean error) {
Throwable throwable = event.getThrowable();
if (throwable != null) {
PluginId pluginId = IdeErrorsDialog.findPluginId(throwable);
if (pluginId != null) {
IdeaPluginDescriptor ideaPluginDescriptor = PluginManager.getPlugin(pluginId);
if (ideaPluginDescriptor != null && !ideaPluginDescriptor.isBundled()) {
error.setPluginName(ideaPluginDescriptor.getName());
error.setPluginVersion(ideaPluginDescriptor.getVersion());
}
}
}
Object data = event.getData();
if (data instanceof AbstractMessage) {
error.setAttachments(((AbstractMessage) data).getIncludedAttachments());
}
}
示例6: canHandle
import com.intellij.openapi.diagnostic.IdeaLoggingEvent; //导入依赖的package包/类
public boolean canHandle(IdeaLoggingEvent event) {
if (ourLoggerBroken) return false;
try {
boolean notificationEnabled = !DISABLED_VALUE.equals(System.getProperty(FATAL_ERROR_NOTIFICATION_PROPERTY, ENABLED_VALUE));
ErrorReportSubmitter submitter = IdeErrorsDialog.getSubmitter(event.getThrowable());
boolean showPluginError = !(submitter instanceof ITNReporter) || ((ITNReporter)submitter).showErrorInRelease(event);
//noinspection ThrowableResultOfMethodCallIgnored
return notificationEnabled ||
showPluginError ||
ApplicationManagerEx.getApplicationEx().isInternal() ||
isOOMError(event.getThrowable()) ||
event.getThrowable() instanceof MappingFailedException;
}
catch (LinkageError e) {
if (e.getMessage().contains("Could not initialize class com.intellij.diagnostic.IdeErrorsDialog")) {
//noinspection AssignmentToStaticFieldFromInstanceMethod
ourLoggerBroken = true;
}
throw e;
}
}
示例7: LogMessage
import com.intellij.openapi.diagnostic.IdeaLoggingEvent; //导入依赖的package包/类
public LogMessage(IdeaLoggingEvent aEvent) {
super();
myThrowable = aEvent.getThrowable();
if (StringUtil.isNotEmpty(aEvent.getMessage())) {
myHeader = aEvent.getMessage();
}
if (myThrowable != null && StringUtil.isNotEmpty(myThrowable.getMessage())) {
if (!myHeader.equals(NO_MESSAGE)) {
if (!myHeader.endsWith(": ") && !myHeader.endsWith(":")) {
myHeader += ": ";
}
myHeader += myThrowable.getMessage();
}
else {
myHeader = myThrowable.getMessage();
}
}
}
示例8: submit
import com.intellij.openapi.diagnostic.IdeaLoggingEvent; //导入依赖的package包/类
@Override
public boolean submit(@NotNull IdeaLoggingEvent[] events, @Nullable String additionalInfo,
@NotNull Component parentComponent, @NotNull Consumer<SubmittedReportInfo> consumer) {
log(events, additionalInfo);
consumer.consume(new SubmittedReportInfo(null, null, NEW_ISSUE));
Messages.showInfoMessage(parentComponent, DEFAULT_RESPONSE, DEFAULT_RESPONSE_TITLE);
return true;
}
示例9: submit
import com.intellij.openapi.diagnostic.IdeaLoggingEvent; //导入依赖的package包/类
@Override
public boolean submit(@NotNull IdeaLoggingEvent[] events, @Nullable String additionalInfo,
@NotNull Component parentComponent, @NotNull Consumer<SubmittedReportInfo> consumer) {
EventBuilder eventBuilder = createEvent(events, additionalInfo);
sentry.sendEvent(eventBuilder);
consumer.consume(new SubmittedReportInfo(null, null, NEW_ISSUE));
Messages.showInfoMessage(parentComponent, DEFAULT_RESPONSE, DEFAULT_RESPONSE_TITLE);
return true;
}
示例10: getMoreEvents
import com.intellij.openapi.diagnostic.IdeaLoggingEvent; //导入依赖的package包/类
@NotNull
private StringBuilder getMoreEvents(@NotNull IdeaLoggingEvent[] events) {
StringBuilder moreEvents = new StringBuilder();
for (int i = 1; i < events.length; i++) {
IdeaLoggingEvent event = events[i];
moreEvents.append(event.toString());
moreEvents.append("\n");
}
return moreEvents;
}
示例11: checkForUpdate
import com.intellij.openapi.diagnostic.IdeaLoggingEvent; //导入依赖的package包/类
public static void checkForUpdate(IdeaLoggingEvent event) {
if (!ourHasFailedPlugins && UpdateSettings.getInstance().isCheckNeeded()) {
final Throwable throwable = event.getThrowable();
final IdeaPluginDescriptor pluginDescriptor = PluginManager.getPlugin(IdeErrorsDialog.findPluginId(throwable));
if (pluginDescriptor != null && !pluginDescriptor.isBundled()) {
ourHasFailedPlugins = true;
updateAndShowResult();
}
}
}
示例12: error
import com.intellij.openapi.diagnostic.IdeaLoggingEvent; //导入依赖的package包/类
@Override
public void error(Object message) {
if (message instanceof IdeaLoggingEvent) {
myLogger.error(message);
}
else {
super.error(message);
}
}
示例13: processMappingFailed
import com.intellij.openapi.diagnostic.IdeaLoggingEvent; //导入依赖的package包/类
private static void processMappingFailed(final IdeaLoggingEvent event) throws InterruptedException, InvocationTargetException {
if (!ourMappingFailedNotificationPosted && SystemInfo.isWindows && SystemInfo.is32Bit) {
ourMappingFailedNotificationPosted = true;
@SuppressWarnings("ThrowableResultOfMethodCallIgnored") String exceptionMessage = event.getThrowable().getMessage();
String text = exceptionMessage +
"<br>Possible cause: unable to allocate continuous memory chunk of necessary size.<br>" +
"Reducing JVM maximum heap size (-Xmx) may help.";
Notifications.Bus.notify(new Notification("Memory", "Memory Mapping Failed", text, NotificationType.WARNING), null);
}
}
示例14: extractLoggingEvent
import com.intellij.openapi.diagnostic.IdeaLoggingEvent; //导入依赖的package包/类
private static IdeaLoggingEvent extractLoggingEvent(Object message, Throwable throwable) {
//noinspection ThrowableResultOfMethodCallIgnored
Throwable rootCause = ExceptionUtil.getRootCause(throwable);
if (rootCause instanceof LogEventException) {
return ((LogEventException)rootCause).getLogMessage();
}
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);
}
示例15: LogMessage
import com.intellij.openapi.diagnostic.IdeaLoggingEvent; //导入依赖的package包/类
public LogMessage(IdeaLoggingEvent aEvent) {
super();
myThrowable = aEvent.getThrowable();
String header = null;
if (!StringUtil.isEmptyOrSpaces(aEvent.getMessage())) {
header = aEvent.getMessage();
}
if (myThrowable != null) {
String message = myThrowable.getMessage();
if (StringUtil.isNotEmpty(message) && (header == null || !header.startsWith(message))) {
if (header != null) {
if (header.endsWith(":")) header += " ";
else if (!header.endsWith(": ")) header += ": ";
header += message;
}
else {
header = message;
}
}
}
if (header == null) {
header = "No message";
}
myHeader = header;
}