Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify breadcrumb API #1603

Merged
merged 4 commits into from
Oct 30, 2023
Merged
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
15 changes: 12 additions & 3 deletions src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,20 @@ function captureCheckIn(string $slug, CheckInStatus $status, $duration = null, ?
* will be added to subsequent events to provide more context on user's
* actions prior to an error or crash.
*
* @param Breadcrumb $breadcrumb The breadcrumb to record
* @param Breadcrumb|string $category The category of the breadcrumb, can be a Breadcrumb instance as well (in which case the other parameters are ignored)
* @param string|null $message Breadcrumb message
* @param array<string, mixed> $metadata Additional information about the breadcrumb
* @param string $level The error level of the breadcrumb
* @param string $type The type of the breadcrumb
* @param float|null $timestamp Optional timestamp of the breadcrumb
*/
function addBreadcrumb(Breadcrumb $breadcrumb): void
function addBreadcrumb($category, ?string $message = null, array $metadata = [], string $level = Breadcrumb::LEVEL_INFO, string $type = Breadcrumb::TYPE_DEFAULT, ?float $timestamp = null): void
{
SentrySdk::getCurrentHub()->addBreadcrumb($breadcrumb);
SentrySdk::getCurrentHub()->addBreadcrumb(
$category instanceof Breadcrumb
? $category
: new Breadcrumb($level, $type, $category, $message, $metadata, $timestamp)
);
}

/**
Expand Down