Skip to content

Commit b01f8f5

Browse files
authored
[Logs 1] Add Sentry Log feature to Java SDK (#4372)
* Add Log feature to Java SDK * changelog * Add manifest option to changelog
1 parent b694d8b commit b01f8f5

27 files changed

+943
-15
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@
66

77
- Add new User Feedback API ([#4286](https://github.com/getsentry/sentry-java/pull/4286))
88
- We now introduced Sentry.captureFeedback, which supersedes Sentry.captureUserFeedback
9+
- Add Sentry Log Feature ([#4372](https://github.com/getsentry/sentry-java/pull/4372))
10+
- The feature is disabled by default and needs to be enabled by:
11+
- `options.getLogs().setEnabled(true)` in `Sentry.init` / `SentryAndroid.init`
12+
- `<meta-data android:name="io.sentry.logs.enabled" android:value="true" />` in `AndroidManifest.xml`
13+
- `logs.enabled=true` in `sentry.properties`
14+
- `sentry.logs.enabled=true` in `application.properties`
15+
- `sentry.logs.enabled: true` in `application.yml`
16+
- Logs can be captured using `Sentry.logger().info()` and similar methods.
17+
- Logs also take a format string and arguments which we then send through `String.format`.
18+
- Please use `options.getLogs().setBeforeSend()` to filter outgoing logs
919

1020
### Fixes
1121

sentry-android-core/src/test/java/io/sentry/android/core/SessionTrackingIntegrationTest.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import io.sentry.ProfilingTraceData
1616
import io.sentry.Sentry
1717
import io.sentry.SentryEnvelope
1818
import io.sentry.SentryEvent
19+
import io.sentry.SentryLogEvents
1920
import io.sentry.SentryOptions
2021
import io.sentry.SentryReplayEvent
2122
import io.sentry.Session
@@ -190,6 +191,10 @@ class SessionTrackingIntegrationTest {
190191
TODO("Not yet implemented")
191192
}
192193

194+
override fun captureLogs(events: SentryLogEvents, scope: IScope?, hint: Hint?) {
195+
TODO("Not yet implemented")
196+
}
197+
193198
override fun getRateLimiter(): RateLimiter? {
194199
TODO("Not yet implemented")
195200
}

sentry/api/sentry.api

Lines changed: 118 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ public final class io/sentry/DataCategory : java/lang/Enum {
371371
public final class io/sentry/DateUtils {
372372
public static fun dateToNanos (Ljava/util/Date;)J
373373
public static fun dateToSeconds (Ljava/util/Date;)D
374+
public static fun doubleToBigDecimal (Ljava/lang/Double;)Ljava/math/BigDecimal;
374375
public static fun getCurrentDateTime ()Ljava/util/Date;
375376
public static fun getDateTime (J)Ljava/util/Date;
376377
public static fun getDateTime (Ljava/lang/String;)Ljava/util/Date;
@@ -640,6 +641,7 @@ public final class io/sentry/HubAdapter : io/sentry/IHub {
640641
public fun isCrashedLastRun ()Ljava/lang/Boolean;
641642
public fun isEnabled ()Z
642643
public fun isHealthy ()Z
644+
public fun logger ()Lio/sentry/logger/ILoggerApi;
643645
public fun makeCurrent ()Lio/sentry/ISentryLifecycleToken;
644646
public fun popScope ()V
645647
public fun pushIsolationScope ()Lio/sentry/ISentryLifecycleToken;
@@ -708,6 +710,7 @@ public final class io/sentry/HubScopesWrapper : io/sentry/IHub {
708710
public fun isCrashedLastRun ()Ljava/lang/Boolean;
709711
public fun isEnabled ()Z
710712
public fun isHealthy ()Z
713+
public fun logger ()Lio/sentry/logger/ILoggerApi;
711714
public fun makeCurrent ()Lio/sentry/ISentryLifecycleToken;
712715
public fun popScope ()V
713716
public fun pushIsolationScope ()Lio/sentry/ISentryLifecycleToken;
@@ -950,6 +953,7 @@ public abstract interface class io/sentry/IScopes {
950953
public abstract fun isEnabled ()Z
951954
public abstract fun isHealthy ()Z
952955
public fun isNoOp ()Z
956+
public abstract fun logger ()Lio/sentry/logger/ILoggerApi;
953957
public abstract fun makeCurrent ()Lio/sentry/ISentryLifecycleToken;
954958
public abstract fun popScope ()V
955959
public abstract fun pushIsolationScope ()Lio/sentry/ISentryLifecycleToken;
@@ -996,6 +1000,7 @@ public abstract interface class io/sentry/ISentryClient {
9961000
public fun captureException (Ljava/lang/Throwable;Lio/sentry/IScope;)Lio/sentry/protocol/SentryId;
9971001
public fun captureException (Ljava/lang/Throwable;Lio/sentry/IScope;Lio/sentry/Hint;)Lio/sentry/protocol/SentryId;
9981002
public abstract fun captureFeedback (Lio/sentry/protocol/Feedback;Lio/sentry/Hint;Lio/sentry/IScope;)Lio/sentry/protocol/SentryId;
1003+
public abstract fun captureLogs (Lio/sentry/SentryLogEvents;Lio/sentry/IScope;Lio/sentry/Hint;)V
9991004
public fun captureMessage (Ljava/lang/String;Lio/sentry/SentryLevel;)Lio/sentry/protocol/SentryId;
10001005
public fun captureMessage (Ljava/lang/String;Lio/sentry/SentryLevel;Lio/sentry/IScope;)Lio/sentry/protocol/SentryId;
10011006
public abstract fun captureProfileChunk (Lio/sentry/ProfileChunk;Lio/sentry/IScope;)Lio/sentry/protocol/SentryId;
@@ -1514,6 +1519,7 @@ public final class io/sentry/NoOpHub : io/sentry/IHub {
15141519
public fun isEnabled ()Z
15151520
public fun isHealthy ()Z
15161521
public fun isNoOp ()Z
1522+
public fun logger ()Lio/sentry/logger/ILoggerApi;
15171523
public fun makeCurrent ()Lio/sentry/ISentryLifecycleToken;
15181524
public fun popScope ()V
15191525
public fun pushIsolationScope ()Lio/sentry/ISentryLifecycleToken;
@@ -1677,6 +1683,7 @@ public final class io/sentry/NoOpScopes : io/sentry/IScopes {
16771683
public fun isEnabled ()Z
16781684
public fun isHealthy ()Z
16791685
public fun isNoOp ()Z
1686+
public fun logger ()Lio/sentry/logger/ILoggerApi;
16801687
public fun makeCurrent ()Lio/sentry/ISentryLifecycleToken;
16811688
public fun popScope ()V
16821689
public fun pushIsolationScope ()Lio/sentry/ISentryLifecycleToken;
@@ -2359,6 +2366,8 @@ public final class io/sentry/Scopes : io/sentry/IScopes {
23592366
public fun forkedRootScopes (Ljava/lang/String;)Lio/sentry/IScopes;
23602367
public fun forkedScopes (Ljava/lang/String;)Lio/sentry/IScopes;
23612368
public fun getBaggage ()Lio/sentry/BaggageHeader;
2369+
public fun getClient ()Lio/sentry/ISentryClient;
2370+
public fun getCombinedScopeView ()Lio/sentry/IScope;
23622371
public fun getCreator ()Ljava/lang/String;
23632372
public fun getGlobalScope ()Lio/sentry/IScope;
23642373
public fun getIsolationScope ()Lio/sentry/IScope;
@@ -2374,6 +2383,7 @@ public final class io/sentry/Scopes : io/sentry/IScopes {
23742383
public fun isCrashedLastRun ()Ljava/lang/Boolean;
23752384
public fun isEnabled ()Z
23762385
public fun isHealthy ()Z
2386+
public fun logger ()Lio/sentry/logger/ILoggerApi;
23772387
public fun makeCurrent ()Lio/sentry/ISentryLifecycleToken;
23782388
public fun popScope ()V
23792389
public fun pushIsolationScope ()Lio/sentry/ISentryLifecycleToken;
@@ -2444,6 +2454,7 @@ public final class io/sentry/ScopesAdapter : io/sentry/IScopes {
24442454
public fun isCrashedLastRun ()Ljava/lang/Boolean;
24452455
public fun isEnabled ()Z
24462456
public fun isHealthy ()Z
2457+
public fun logger ()Lio/sentry/logger/ILoggerApi;
24472458
public fun makeCurrent ()Lio/sentry/ISentryLifecycleToken;
24482459
public fun popScope ()V
24492460
public fun pushIsolationScope ()Lio/sentry/ISentryLifecycleToken;
@@ -2554,6 +2565,7 @@ public final class io/sentry/Sentry {
25542565
public static fun isCrashedLastRun ()Ljava/lang/Boolean;
25552566
public static fun isEnabled ()Z
25562567
public static fun isHealthy ()Z
2568+
public static fun logger ()Lio/sentry/logger/ILoggerApi;
25572569
public static fun popScope ()V
25582570
public static fun pushIsolationScope ()Lio/sentry/ISentryLifecycleToken;
25592571
public static fun pushScope ()Lio/sentry/ISentryLifecycleToken;
@@ -2721,6 +2733,7 @@ public final class io/sentry/SentryClient : io/sentry/ISentryClient {
27212733
public fun captureEnvelope (Lio/sentry/SentryEnvelope;Lio/sentry/Hint;)Lio/sentry/protocol/SentryId;
27222734
public fun captureEvent (Lio/sentry/SentryEvent;Lio/sentry/IScope;Lio/sentry/Hint;)Lio/sentry/protocol/SentryId;
27232735
public fun captureFeedback (Lio/sentry/protocol/Feedback;Lio/sentry/Hint;Lio/sentry/IScope;)Lio/sentry/protocol/SentryId;
2736+
public fun captureLogs (Lio/sentry/SentryLogEvents;Lio/sentry/IScope;Lio/sentry/Hint;)V
27242737
public fun captureProfileChunk (Lio/sentry/ProfileChunk;Lio/sentry/IScope;)Lio/sentry/protocol/SentryId;
27252738
public fun captureReplayEvent (Lio/sentry/SentryReplayEvent;Lio/sentry/IScope;Lio/sentry/Hint;)Lio/sentry/protocol/SentryId;
27262739
public fun captureSession (Lio/sentry/Session;Lio/sentry/Hint;)V
@@ -2801,6 +2814,7 @@ public final class io/sentry/SentryEnvelopeItem {
28012814
public static fun fromCheckIn (Lio/sentry/ISerializer;Lio/sentry/CheckIn;)Lio/sentry/SentryEnvelopeItem;
28022815
public static fun fromClientReport (Lio/sentry/ISerializer;Lio/sentry/clientreport/ClientReport;)Lio/sentry/SentryEnvelopeItem;
28032816
public static fun fromEvent (Lio/sentry/ISerializer;Lio/sentry/SentryBaseEvent;)Lio/sentry/SentryEnvelopeItem;
2817+
public static fun fromLogs (Lio/sentry/ISerializer;Lio/sentry/SentryLogEvents;)Lio/sentry/SentryEnvelopeItem;
28042818
public static fun fromProfileChunk (Lio/sentry/ProfileChunk;Lio/sentry/ISerializer;)Lio/sentry/SentryEnvelopeItem;
28052819
public static fun fromProfilingTrace (Lio/sentry/ProfilingTraceData;JLio/sentry/ISerializer;)Lio/sentry/SentryEnvelopeItem;
28062820
public static fun fromReplay (Lio/sentry/ISerializer;Lio/sentry/ILogger;Lio/sentry/SentryReplayEvent;Lio/sentry/ReplayRecording;Z)Lio/sentry/SentryEnvelopeItem;
@@ -2814,7 +2828,7 @@ public final class io/sentry/SentryEnvelopeItem {
28142828
}
28152829

28162830
public final class io/sentry/SentryEnvelopeItemHeader : io/sentry/JsonSerializable, io/sentry/JsonUnknown {
2817-
public fun <init> (Lio/sentry/SentryItemType;ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
2831+
public fun <init> (Lio/sentry/SentryItemType;ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;)V
28182832
public fun getAttachmentType ()Ljava/lang/String;
28192833
public fun getContentType ()Ljava/lang/String;
28202834
public fun getFileName ()Ljava/lang/String;
@@ -2836,6 +2850,7 @@ public final class io/sentry/SentryEnvelopeItemHeader$JsonKeys {
28362850
public static final field ATTACHMENT_TYPE Ljava/lang/String;
28372851
public static final field CONTENT_TYPE Ljava/lang/String;
28382852
public static final field FILENAME Ljava/lang/String;
2853+
public static final field ITEM_COUNT Ljava/lang/String;
28392854
public static final field LENGTH Ljava/lang/String;
28402855
public static final field PLATFORM Ljava/lang/String;
28412856
public static final field TYPE Ljava/lang/String;
@@ -2935,6 +2950,7 @@ public final class io/sentry/SentryItemType : java/lang/Enum, io/sentry/JsonSeri
29352950
public static final field ClientReport Lio/sentry/SentryItemType;
29362951
public static final field Event Lio/sentry/SentryItemType;
29372952
public static final field Feedback Lio/sentry/SentryItemType;
2953+
public static final field Log Lio/sentry/SentryItemType;
29382954
public static final field Profile Lio/sentry/SentryItemType;
29392955
public static final field ProfileChunk Lio/sentry/SentryItemType;
29402956
public static final field ReplayEvent Lio/sentry/SentryItemType;
@@ -3015,6 +3031,72 @@ public final class io/sentry/SentryLockReason$JsonKeys {
30153031
public fun <init> ()V
30163032
}
30173033

3034+
public final class io/sentry/SentryLogEvent : io/sentry/JsonSerializable, io/sentry/JsonUnknown {
3035+
public fun <init> (Lio/sentry/protocol/SentryId;Lio/sentry/SentryDate;Ljava/lang/String;)V
3036+
public fun <init> (Lio/sentry/protocol/SentryId;Ljava/lang/Double;Ljava/lang/String;)V
3037+
public fun getAttributes ()Ljava/util/Map;
3038+
public fun getLevel ()Lio/sentry/SentryLevel;
3039+
public fun getTimestamp ()Ljava/lang/Double;
3040+
public fun getUnknown ()Ljava/util/Map;
3041+
public fun serialize (Lio/sentry/ObjectWriter;Lio/sentry/ILogger;)V
3042+
public fun setAttributes (Ljava/util/Map;)V
3043+
public fun setLevel (Lio/sentry/SentryLevel;)V
3044+
public fun setTimestamp (Ljava/lang/Double;)V
3045+
public fun setUnknown (Ljava/util/Map;)V
3046+
}
3047+
3048+
public final class io/sentry/SentryLogEvent$Deserializer : io/sentry/JsonDeserializer {
3049+
public fun <init> ()V
3050+
public fun deserialize (Lio/sentry/ObjectReader;Lio/sentry/ILogger;)Lio/sentry/SentryLogEvent;
3051+
public synthetic fun deserialize (Lio/sentry/ObjectReader;Lio/sentry/ILogger;)Ljava/lang/Object;
3052+
}
3053+
3054+
public final class io/sentry/SentryLogEvent$JsonKeys {
3055+
public static final field ATTRIBUTES Ljava/lang/String;
3056+
public static final field BODY Ljava/lang/String;
3057+
public static final field LEVEL Ljava/lang/String;
3058+
public static final field TIMESTAMP Ljava/lang/String;
3059+
public static final field TRACE_ID Ljava/lang/String;
3060+
public fun <init> ()V
3061+
}
3062+
3063+
public final class io/sentry/SentryLogEventAttributeValue : io/sentry/JsonSerializable, io/sentry/JsonUnknown {
3064+
public fun <init> (Ljava/lang/String;Ljava/lang/Object;)V
3065+
public fun getUnknown ()Ljava/util/Map;
3066+
public fun serialize (Lio/sentry/ObjectWriter;Lio/sentry/ILogger;)V
3067+
public fun setUnknown (Ljava/util/Map;)V
3068+
}
3069+
3070+
public final class io/sentry/SentryLogEventAttributeValue$Deserializer : io/sentry/JsonDeserializer {
3071+
public fun <init> ()V
3072+
public fun deserialize (Lio/sentry/ObjectReader;Lio/sentry/ILogger;)Lio/sentry/SentryLogEventAttributeValue;
3073+
public synthetic fun deserialize (Lio/sentry/ObjectReader;Lio/sentry/ILogger;)Ljava/lang/Object;
3074+
}
3075+
3076+
public final class io/sentry/SentryLogEventAttributeValue$JsonKeys {
3077+
public static final field TYPE Ljava/lang/String;
3078+
public static final field VALUE Ljava/lang/String;
3079+
public fun <init> ()V
3080+
}
3081+
3082+
public final class io/sentry/SentryLogEvents : io/sentry/JsonSerializable, io/sentry/JsonUnknown {
3083+
public fun <init> (Ljava/util/List;)V
3084+
public fun getUnknown ()Ljava/util/Map;
3085+
public fun serialize (Lio/sentry/ObjectWriter;Lio/sentry/ILogger;)V
3086+
public fun setUnknown (Ljava/util/Map;)V
3087+
}
3088+
3089+
public final class io/sentry/SentryLogEvents$Deserializer : io/sentry/JsonDeserializer {
3090+
public fun <init> ()V
3091+
public fun deserialize (Lio/sentry/ObjectReader;Lio/sentry/ILogger;)Lio/sentry/SentryLogEvents;
3092+
public synthetic fun deserialize (Lio/sentry/ObjectReader;Lio/sentry/ILogger;)Ljava/lang/Object;
3093+
}
3094+
3095+
public final class io/sentry/SentryLogEvents$JsonKeys {
3096+
public static final field ITEMS Ljava/lang/String;
3097+
public fun <init> ()V
3098+
}
3099+
30183100
public final class io/sentry/SentryLongDate : io/sentry/SentryDate {
30193101
public fun <init> (J)V
30203102
public fun nanoTimestamp ()J
@@ -4571,6 +4653,41 @@ public abstract interface class io/sentry/internal/viewhierarchy/ViewHierarchyEx
45714653
public abstract fun export (Lio/sentry/protocol/ViewHierarchyNode;Ljava/lang/Object;)Z
45724654
}
45734655

4656+
public abstract interface class io/sentry/logger/ILoggerApi {
4657+
public abstract fun debug (Ljava/lang/String;[Ljava/lang/Object;)V
4658+
public abstract fun error (Ljava/lang/String;[Ljava/lang/Object;)V
4659+
public abstract fun fatal (Ljava/lang/String;[Ljava/lang/Object;)V
4660+
public abstract fun info (Ljava/lang/String;[Ljava/lang/Object;)V
4661+
public abstract fun log (Lio/sentry/SentryLevel;Lio/sentry/SentryDate;Ljava/lang/String;Lio/sentry/Hint;[Ljava/lang/Object;)V
4662+
public abstract fun log (Lio/sentry/SentryLevel;Ljava/lang/String;[Ljava/lang/Object;)V
4663+
public abstract fun trace (Ljava/lang/String;[Ljava/lang/Object;)V
4664+
public abstract fun warn (Ljava/lang/String;[Ljava/lang/Object;)V
4665+
}
4666+
4667+
public final class io/sentry/logger/LoggerApi : io/sentry/logger/ILoggerApi {
4668+
public fun <init> (Lio/sentry/Scopes;)V
4669+
public fun debug (Ljava/lang/String;[Ljava/lang/Object;)V
4670+
public fun error (Ljava/lang/String;[Ljava/lang/Object;)V
4671+
public fun fatal (Ljava/lang/String;[Ljava/lang/Object;)V
4672+
public fun info (Ljava/lang/String;[Ljava/lang/Object;)V
4673+
public fun log (Lio/sentry/SentryLevel;Lio/sentry/SentryDate;Ljava/lang/String;Lio/sentry/Hint;[Ljava/lang/Object;)V
4674+
public fun log (Lio/sentry/SentryLevel;Ljava/lang/String;[Ljava/lang/Object;)V
4675+
public fun trace (Ljava/lang/String;[Ljava/lang/Object;)V
4676+
public fun warn (Ljava/lang/String;[Ljava/lang/Object;)V
4677+
}
4678+
4679+
public final class io/sentry/logger/NoOpLoggerApi : io/sentry/logger/ILoggerApi {
4680+
public fun debug (Ljava/lang/String;[Ljava/lang/Object;)V
4681+
public fun error (Ljava/lang/String;[Ljava/lang/Object;)V
4682+
public fun fatal (Ljava/lang/String;[Ljava/lang/Object;)V
4683+
public static fun getInstance ()Lio/sentry/logger/NoOpLoggerApi;
4684+
public fun info (Ljava/lang/String;[Ljava/lang/Object;)V
4685+
public fun log (Lio/sentry/SentryLevel;Lio/sentry/SentryDate;Ljava/lang/String;Lio/sentry/Hint;[Ljava/lang/Object;)V
4686+
public fun log (Lio/sentry/SentryLevel;Ljava/lang/String;[Ljava/lang/Object;)V
4687+
public fun trace (Ljava/lang/String;[Ljava/lang/Object;)V
4688+
public fun warn (Ljava/lang/String;[Ljava/lang/Object;)V
4689+
}
4690+
45744691
public final class io/sentry/opentelemetry/OpenTelemetryUtil {
45754692
public fun <init> ()V
45764693
public static fun applyIgnoredSpanOrigins (Lio/sentry/SentryOptions;)V

sentry/src/main/java/io/sentry/DateUtils.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,4 +165,8 @@ public static long dateToNanos(final @NotNull Date date) {
165165
public static long secondsToNanos(final @NotNull long seconds) {
166166
return seconds * (1000L * 1000L * 1000L);
167167
}
168+
169+
public static @NotNull BigDecimal doubleToBigDecimal(final @NotNull Double value) {
170+
return BigDecimal.valueOf(value).setScale(6, RoundingMode.DOWN);
171+
}
168172
}

sentry/src/main/java/io/sentry/HubAdapter.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.sentry;
22

3+
import io.sentry.logger.ILoggerApi;
34
import io.sentry.protocol.Feedback;
45
import io.sentry.protocol.SentryId;
56
import io.sentry.protocol.SentryTransaction;
@@ -382,4 +383,10 @@ public void reportFullyDisplayed() {
382383
public @Nullable RateLimiter getRateLimiter() {
383384
return Sentry.getCurrentScopes().getRateLimiter();
384385
}
386+
387+
@ApiStatus.Experimental
388+
@Override
389+
public @NotNull ILoggerApi logger() {
390+
return Sentry.getCurrentScopes().logger();
391+
}
385392
}

sentry/src/main/java/io/sentry/HubScopesWrapper.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.sentry;
22

3+
import io.sentry.logger.ILoggerApi;
34
import io.sentry.protocol.Feedback;
45
import io.sentry.protocol.SentryId;
56
import io.sentry.protocol.SentryTransaction;
@@ -364,4 +365,10 @@ public void reportFullyDisplayed() {
364365
public @NotNull SentryId captureReplay(@NotNull SentryReplayEvent replay, @Nullable Hint hint) {
365366
return scopes.captureReplay(replay, hint);
366367
}
368+
369+
@ApiStatus.Experimental
370+
@Override
371+
public @NotNull ILoggerApi logger() {
372+
return scopes.logger();
373+
}
367374
}

sentry/src/main/java/io/sentry/IScopes.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.sentry;
22

3+
import io.sentry.logger.ILoggerApi;
34
import io.sentry.protocol.Feedback;
45
import io.sentry.protocol.SentryId;
56
import io.sentry.protocol.SentryTransaction;
@@ -740,4 +741,8 @@ default boolean isNoOp() {
740741

741742
@NotNull
742743
SentryId captureReplay(@NotNull SentryReplayEvent replay, @Nullable Hint hint);
744+
745+
@ApiStatus.Experimental
746+
@NotNull
747+
ILoggerApi logger();
743748
}

sentry/src/main/java/io/sentry/ISentryClient.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,9 @@ SentryId captureProfileChunk(
304304
@ApiStatus.Experimental
305305
SentryId captureCheckIn(@NotNull CheckIn checkIn, @Nullable IScope scope, @Nullable Hint hint);
306306

307+
@ApiStatus.Experimental
308+
void captureLogs(@NotNull SentryLogEvents logEvents, @Nullable IScope scope, @Nullable Hint hint);
309+
307310
@ApiStatus.Internal
308311
@Nullable
309312
RateLimiter getRateLimiter();

sentry/src/main/java/io/sentry/NoOpHub.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package io.sentry;
22

3+
import io.sentry.logger.ILoggerApi;
4+
import io.sentry.logger.NoOpLoggerApi;
35
import io.sentry.protocol.Feedback;
46
import io.sentry.protocol.SentryId;
57
import io.sentry.protocol.SentryTransaction;
@@ -324,4 +326,10 @@ public void reportFullyDisplayed() {}
324326
public boolean isNoOp() {
325327
return true;
326328
}
329+
330+
@ApiStatus.Experimental
331+
@Override
332+
public @NotNull ILoggerApi logger() {
333+
return NoOpLoggerApi.getInstance();
334+
}
327335
}

sentry/src/main/java/io/sentry/NoOpScopes.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package io.sentry;
22

3+
import io.sentry.logger.ILoggerApi;
4+
import io.sentry.logger.NoOpLoggerApi;
35
import io.sentry.protocol.Feedback;
46
import io.sentry.protocol.SentryId;
57
import io.sentry.protocol.SentryTransaction;
@@ -319,4 +321,10 @@ public boolean isNoOp() {
319321
public @NotNull SentryId captureReplay(@NotNull SentryReplayEvent replay, @Nullable Hint hint) {
320322
return SentryId.EMPTY_ID;
321323
}
324+
325+
@ApiStatus.Experimental
326+
@Override
327+
public @NotNull ILoggerApi logger() {
328+
return NoOpLoggerApi.getInstance();
329+
}
322330
}

0 commit comments

Comments
 (0)