diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/SessionTrackingIntegrationTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/SessionTrackingIntegrationTest.kt index 0db6161ec8..32a0e20127 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/SessionTrackingIntegrationTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/SessionTrackingIntegrationTest.kt @@ -192,7 +192,7 @@ class SessionTrackingIntegrationTest { TODO("Not yet implemented") } - override fun captureLog(event: SentryLogEvent, scope: IScope?, hint: Hint?) { + override fun captureLog(event: SentryLogEvent, scope: IScope?) { TODO("Not yet implemented") } diff --git a/sentry/api/sentry.api b/sentry/api/sentry.api index 8b9a48a031..ba44ff0c48 100644 --- a/sentry/api/sentry.api +++ b/sentry/api/sentry.api @@ -1004,7 +1004,7 @@ public abstract interface class io/sentry/ISentryClient { public fun captureException (Ljava/lang/Throwable;Lio/sentry/IScope;)Lio/sentry/protocol/SentryId; public fun captureException (Ljava/lang/Throwable;Lio/sentry/IScope;Lio/sentry/Hint;)Lio/sentry/protocol/SentryId; public abstract fun captureFeedback (Lio/sentry/protocol/Feedback;Lio/sentry/Hint;Lio/sentry/IScope;)Lio/sentry/protocol/SentryId; - public abstract fun captureLog (Lio/sentry/SentryLogEvent;Lio/sentry/IScope;Lio/sentry/Hint;)V + public abstract fun captureLog (Lio/sentry/SentryLogEvent;Lio/sentry/IScope;)V public fun captureMessage (Ljava/lang/String;Lio/sentry/SentryLevel;)Lio/sentry/protocol/SentryId; public fun captureMessage (Ljava/lang/String;Lio/sentry/SentryLevel;Lio/sentry/IScope;)Lio/sentry/protocol/SentryId; public abstract fun captureProfileChunk (Lio/sentry/ProfileChunk;Lio/sentry/IScope;)Lio/sentry/protocol/SentryId; @@ -2738,7 +2738,7 @@ public final class io/sentry/SentryClient : io/sentry/ISentryClient { public fun captureEnvelope (Lio/sentry/SentryEnvelope;Lio/sentry/Hint;)Lio/sentry/protocol/SentryId; public fun captureEvent (Lio/sentry/SentryEvent;Lio/sentry/IScope;Lio/sentry/Hint;)Lio/sentry/protocol/SentryId; public fun captureFeedback (Lio/sentry/protocol/Feedback;Lio/sentry/Hint;Lio/sentry/IScope;)Lio/sentry/protocol/SentryId; - public fun captureLog (Lio/sentry/SentryLogEvent;Lio/sentry/IScope;Lio/sentry/Hint;)V + public fun captureLog (Lio/sentry/SentryLogEvent;Lio/sentry/IScope;)V public fun captureProfileChunk (Lio/sentry/ProfileChunk;Lio/sentry/IScope;)Lio/sentry/protocol/SentryId; public fun captureReplayEvent (Lio/sentry/SentryReplayEvent;Lio/sentry/IScope;Lio/sentry/Hint;)Lio/sentry/protocol/SentryId; public fun captureSession (Lio/sentry/Session;Lio/sentry/Hint;)V @@ -3464,7 +3464,7 @@ public final class io/sentry/SentryOptions$Logs { } public abstract interface class io/sentry/SentryOptions$Logs$BeforeSendLogCallback { - public abstract fun execute (Lio/sentry/SentryLogEvent;Lio/sentry/Hint;)Lio/sentry/SentryLogEvent; + public abstract fun execute (Lio/sentry/SentryLogEvent;)Lio/sentry/SentryLogEvent; } public abstract interface class io/sentry/SentryOptions$ProfilesSamplerCallback { @@ -4703,7 +4703,7 @@ public abstract interface class io/sentry/logger/ILoggerApi { public abstract fun error (Ljava/lang/String;[Ljava/lang/Object;)V public abstract fun fatal (Ljava/lang/String;[Ljava/lang/Object;)V public abstract fun info (Ljava/lang/String;[Ljava/lang/Object;)V - public abstract fun log (Lio/sentry/SentryLogLevel;Lio/sentry/SentryDate;Ljava/lang/String;Lio/sentry/Hint;[Ljava/lang/Object;)V + public abstract fun log (Lio/sentry/SentryLogLevel;Lio/sentry/SentryDate;Ljava/lang/String;[Ljava/lang/Object;)V public abstract fun log (Lio/sentry/SentryLogLevel;Ljava/lang/String;[Ljava/lang/Object;)V public abstract fun trace (Ljava/lang/String;[Ljava/lang/Object;)V public abstract fun warn (Ljava/lang/String;[Ljava/lang/Object;)V @@ -4720,7 +4720,7 @@ public final class io/sentry/logger/LoggerApi : io/sentry/logger/ILoggerApi { public fun error (Ljava/lang/String;[Ljava/lang/Object;)V public fun fatal (Ljava/lang/String;[Ljava/lang/Object;)V public fun info (Ljava/lang/String;[Ljava/lang/Object;)V - public fun log (Lio/sentry/SentryLogLevel;Lio/sentry/SentryDate;Ljava/lang/String;Lio/sentry/Hint;[Ljava/lang/Object;)V + public fun log (Lio/sentry/SentryLogLevel;Lio/sentry/SentryDate;Ljava/lang/String;[Ljava/lang/Object;)V public fun log (Lio/sentry/SentryLogLevel;Ljava/lang/String;[Ljava/lang/Object;)V public fun trace (Ljava/lang/String;[Ljava/lang/Object;)V public fun warn (Ljava/lang/String;[Ljava/lang/Object;)V @@ -4740,7 +4740,7 @@ public final class io/sentry/logger/NoOpLoggerApi : io/sentry/logger/ILoggerApi public fun fatal (Ljava/lang/String;[Ljava/lang/Object;)V public static fun getInstance ()Lio/sentry/logger/NoOpLoggerApi; public fun info (Ljava/lang/String;[Ljava/lang/Object;)V - public fun log (Lio/sentry/SentryLogLevel;Lio/sentry/SentryDate;Ljava/lang/String;Lio/sentry/Hint;[Ljava/lang/Object;)V + public fun log (Lio/sentry/SentryLogLevel;Lio/sentry/SentryDate;Ljava/lang/String;[Ljava/lang/Object;)V public fun log (Lio/sentry/SentryLogLevel;Ljava/lang/String;[Ljava/lang/Object;)V public fun trace (Ljava/lang/String;[Ljava/lang/Object;)V public fun warn (Ljava/lang/String;[Ljava/lang/Object;)V diff --git a/sentry/src/main/java/io/sentry/ISentryClient.java b/sentry/src/main/java/io/sentry/ISentryClient.java index 888da3f206..b01988a72a 100644 --- a/sentry/src/main/java/io/sentry/ISentryClient.java +++ b/sentry/src/main/java/io/sentry/ISentryClient.java @@ -305,9 +305,9 @@ SentryId captureProfileChunk( SentryId captureCheckIn(@NotNull CheckIn checkIn, @Nullable IScope scope, @Nullable Hint hint); @ApiStatus.Experimental - void captureLog(@NotNull SentryLogEvent logEvent, @Nullable IScope scope, @Nullable Hint hint); + void captureLog(@NotNull SentryLogEvent logEvent, @Nullable IScope scope); - @ApiStatus.Experimental + @ApiStatus.Internal void captureBatchedLogEvents(@NotNull SentryLogEvents logEvents); @ApiStatus.Internal diff --git a/sentry/src/main/java/io/sentry/NoOpSentryClient.java b/sentry/src/main/java/io/sentry/NoOpSentryClient.java index 191034fb4d..97eed16b9c 100644 --- a/sentry/src/main/java/io/sentry/NoOpSentryClient.java +++ b/sentry/src/main/java/io/sentry/NoOpSentryClient.java @@ -86,12 +86,11 @@ public SentryId captureEnvelope(@NotNull SentryEnvelope envelope, @Nullable Hint @ApiStatus.Experimental @Override - public void captureLog( - @NotNull SentryLogEvent logEvent, @Nullable IScope scope, @Nullable Hint hint) { + public void captureLog(@NotNull SentryLogEvent logEvent, @Nullable IScope scope) { // do nothing } - @ApiStatus.Experimental + @ApiStatus.Internal @Override public void captureBatchedLogEvents(@NotNull SentryLogEvents logEvents) { // do nothing diff --git a/sentry/src/main/java/io/sentry/SentryClient.java b/sentry/src/main/java/io/sentry/SentryClient.java index e0663441a6..3163d31ca0 100644 --- a/sentry/src/main/java/io/sentry/SentryClient.java +++ b/sentry/src/main/java/io/sentry/SentryClient.java @@ -1132,26 +1132,10 @@ public void captureSession(final @NotNull Session session, final @Nullable Hint @ApiStatus.Experimental @Override - public void captureLog( - @Nullable SentryLogEvent logEvent, @Nullable IScope scope, @Nullable Hint hint) { - if (hint == null) { - hint = new Hint(); - } - - // @Nullable TraceContext traceContext = null; - // if (scope != null) { - // final @Nullable ITransaction transaction = scope.getTransaction(); - // if (transaction != null) { - // traceContext = transaction.traceContext(); - // } else { - // final @NotNull PropagationContext propagationContext = - // TracingUtils.maybeUpdateBaggage(scope, options); - // traceContext = propagationContext.traceContext(); - // } - // } + public void captureLog(@Nullable SentryLogEvent logEvent, @Nullable IScope scope) { if (logEvent != null) { - logEvent = executeBeforeSendLog(logEvent, hint); + logEvent = executeBeforeSendLog(logEvent); if (logEvent == null) { options.getLogger().log(SentryLevel.DEBUG, "Log Event was dropped by beforeSendLog"); @@ -1163,10 +1147,9 @@ public void captureLog( loggerBatchProcessor.add(logEvent); } - - hint.clear(); } + @ApiStatus.Internal @Override public void captureBatchedLogEvents(final @NotNull SentryLogEvents logEvents) { try { @@ -1453,13 +1436,12 @@ private void sortBreadcrumbsByDate( return event; } - private @Nullable SentryLogEvent executeBeforeSendLog( - @NotNull SentryLogEvent event, final @NotNull Hint hint) { + private @Nullable SentryLogEvent executeBeforeSendLog(@NotNull SentryLogEvent event) { final SentryOptions.Logs.BeforeSendLogCallback beforeSendLog = options.getLogs().getBeforeSend(); if (beforeSendLog != null) { try { - event = beforeSendLog.execute(event, hint); + event = beforeSendLog.execute(event); } catch (Throwable e) { options .getLogger() diff --git a/sentry/src/main/java/io/sentry/SentryLogEventAttributeValue.java b/sentry/src/main/java/io/sentry/SentryLogEventAttributeValue.java index 8aa7cc7fa2..6aa1157952 100644 --- a/sentry/src/main/java/io/sentry/SentryLogEventAttributeValue.java +++ b/sentry/src/main/java/io/sentry/SentryLogEventAttributeValue.java @@ -10,10 +10,10 @@ public final class SentryLogEventAttributeValue implements JsonUnknown, JsonSerializable { private @NotNull String type; - private @NotNull Object value; + private @Nullable Object value; private @Nullable Map unknown; - public SentryLogEventAttributeValue(final @NotNull String type, final @NotNull Object value) { + public SentryLogEventAttributeValue(final @NotNull String type, final @Nullable Object value) { this.type = type; this.value = value; } @@ -88,13 +88,6 @@ public static final class Deserializer implements JsonDeserializer= MAX_BATCH_SIZE) { - flushInternal(); - } + do { + flushBatch(); + } while (queue.size() >= MAX_BATCH_SIZE); } private void flushBatch() { diff --git a/sentry/src/main/java/io/sentry/logger/NoOpLoggerApi.java b/sentry/src/main/java/io/sentry/logger/NoOpLoggerApi.java index 1a9ae1b94a..5c1e0d850f 100644 --- a/sentry/src/main/java/io/sentry/logger/NoOpLoggerApi.java +++ b/sentry/src/main/java/io/sentry/logger/NoOpLoggerApi.java @@ -1,6 +1,5 @@ package io.sentry.logger; -import io.sentry.Hint; import io.sentry.SentryDate; import io.sentry.SentryLogLevel; import org.jetbrains.annotations.ApiStatus; @@ -59,7 +58,6 @@ public void log( @NotNull SentryLogLevel level, @Nullable SentryDate timestamp, @Nullable String message, - final @Nullable Hint hint, @Nullable Object... args) { // do nothing }