{% extends "sentry/partial/client_config/java_base.html" %}

{% load i18n %}

{% block inner %}
    <p>{% trans "You can manually send events using the EventBuilder:" %}</p>

    <pre>import net.kencochrane.raven.Raven;
import net.kencochrane.raven.Raven;
import net.kencochrane.raven.event.EventBuilder;
import net.kencochrane.raven.event.interfaces.ExceptionInterface;

public class Example {
    public static void main(String[] args) {
        String rawDsn = "{% if dsn %}{{ dsn }}{% else %}<strong class="dsn">SENTRY_DSN</strong>{% endif %}";
        Raven raven = RavenFactory.ravenInstance(new Dsn(rawDsn));

        // {% trans "record a simple message" %}
        EventBuilder eventBuilder = new EventBuilder()
                        .setMessage("Hello from Raven!")
                        .setLevel(Event.Level.ERROR)
                        .setLogger(MyClass.class.getName())
                        .addSentryInterface(new ExceptionInterface(e));

        raven.runBuilderHelpers(eventBuilder); // Optional
        raven.sendEvent(eventBuilder.build());
    }
}</pre>
{% endblock %}
