Example usage for com.intellij.openapi.diagnostic ErrorLogger handle

List of usage examples for com.intellij.openapi.diagnostic ErrorLogger handle

Introduction

In this page you can find the example usage for com.intellij.openapi.diagnostic ErrorLogger handle.

Prototype

void handle(IdeaLoggingEvent event);

Source Link

Document

Error event handling occurs in a separate thread.

Usage

From source file:com.intellij.diagnostic.DialogAppender.java

License:Apache License

void appendToLoggers(@NotNull LoggingEvent event, @NotNull ErrorLogger[] errorLoggers) {
    if (myDialogRunnable != null) {
        return;/*  w w w  . j a  v a  2 s .  c  om*/
    }

    final IdeaLoggingEvent ideaEvent;
    final Object message = event.getMessage();
    if (message instanceof IdeaLoggingEvent) {
        ideaEvent = (IdeaLoggingEvent) message;
    } else {
        ThrowableInformation info = event.getThrowableInformation();
        if (info == null) {
            return;
        }
        ideaEvent = extractLoggingEvent(message, info.getThrowable());
    }
    for (int i = errorLoggers.length - 1; i >= 0; i--) {
        final ErrorLogger logger = errorLoggers[i];
        if (!logger.canHandle(ideaEvent)) {
            continue;
        }
        myDialogRunnable = new Runnable() {
            @Override
            public void run() {
                try {
                    logger.handle(ideaEvent);
                } finally {
                    myDialogRunnable = null;
                }
            }
        };

        final Application app = ApplicationManager.getApplication();
        if (app == null) {
            new Thread(myDialogRunnable).start();
        } else {
            app.executeOnPooledThread(myDialogRunnable);
        }
        break;
    }
}