Skip to content

Commit

Permalink
Remove extra SentryConfig.init (#300)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Feb 21, 2025
1 parent 257c4c6 commit 8327246
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import static java.util.function.Predicate.not;

import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
Expand All @@ -15,7 +17,6 @@
import io.quarkus.runtime.RuntimeValue;
import io.quarkus.runtime.annotations.Recorder;
import io.quarkus.runtime.configuration.ConfigurationException;
import io.sentry.Sentry;
import io.sentry.SentryOptions;
import io.sentry.jul.SentryHandler;

Expand All @@ -31,10 +32,14 @@ public RuntimeValue<Optional<Handler>> create(final SentryConfig config) {

// Init Sentry
final SentryOptions options = toSentryOptions(config);
Sentry.init(options);
SentryHandler handler = new SentryHandler(options);
handler.setLevel(config.level());
handler.setPrintfStyle(true);
try {
handler.setEncoding(StandardCharsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
LOG.warn("Could not set encoding for Sentry handler", e);
}
handler.setMinimumEventLevel(config.minimumEventLevel() != null ? config.minimumEventLevel() : config.level());
handler.setMinimumBreadcrumbLevel(config.minimumBreadcrumbLevel());
LOG.infof("Sentry connected to: %s", config.dsn().orElse("?"));
Expand Down

0 comments on commit 8327246

Please sign in to comment.