Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

Add method to add breadcrumb with string parameter. #500

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions sentry-core/src/main/java/io/sentry/core/SentryEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ public void addBreadcrumb(Breadcrumb breadcrumb) {
breadcrumbs.add(breadcrumb);
}

public void addBreadcrumb(final @Nullable String message) {
this.addBreadcrumb(new Breadcrumb(message));
}

Map<String, String> getTags() {
return tags;
}
Expand Down
7 changes: 7 additions & 0 deletions sentry-core/src/test/java/io/sentry/core/SentryEventTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,11 @@ class SentryEventTest {
event.exceptions = sentryExceptions
assertFalse(event.isCrashed)
}

@Test
fun `adds breadcrumb with string as a parameter`() {
val event = SentryEvent()
event.addBreadcrumb("breadcrumb")
assertEquals(1, event.breadcrumbs.filter { it.message == "breadcrumb" }.size)
}
}