File tree Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 1212* Enhancement: Polish Performance API (#1165 )
1313* Enhancement: Set "debug" through external properties (#1186 )
1414* Enhancement: Simplify Spring integration (#1188 )
15+ * Enhancement: Init overload with dsn (#1195 )
1516* Enhancement: Enable Kotlin map-like access on CustomSamplingContext (#1192 )
1617* Enhancement: Auto register custom ITransportFactory in Spring integration (#1194 )
1718* Enhancement: Improve Kotlin property access in Performance API (#1193 )
Original file line number Diff line number Diff line change @@ -59,6 +59,15 @@ public static void init() {
5959 init (options -> options .setEnableExternalConfiguration (true ), GLOBAL_HUB_DEFAULT_MODE );
6060 }
6161
62+ /**
63+ * Initializes the SDK
64+ *
65+ * @param dsn The Sentry DSN
66+ */
67+ public static void init (final @ NotNull String dsn ) {
68+ init (options -> options .setDsn (dsn ));
69+ }
70+
6271 /**
6372 * Initializes the SDK
6473 *
Original file line number Diff line number Diff line change @@ -105,6 +105,18 @@ class SentryTest {
105105 verify(logger).log(eq(SentryLevel .WARNING ), eq(" Sentry has been already initialized. Previous configuration will be overwritten." ))
106106 }
107107
108+ @Test
109+ fun `warns about multiple Sentry initializations with string overload` () {
110+ val logger = mock<ILogger >()
111+ Sentry .init (dsn)
112+ Sentry .init {
113+ it.dsn = dsn
114+ it.setDebug(true )
115+ it.setLogger(logger)
116+ }
117+ verify(logger).log(eq(SentryLevel .WARNING ), eq(" Sentry has been already initialized. Previous configuration will be overwritten." ))
118+ }
119+
108120 @Test
109121 fun `initializes Sentry using external properties` () {
110122 // create a sentry.properties file in temporary folder
You can’t perform that action at this time.
0 commit comments