Skip to content

Commit

Permalink
Simplify breadcrumb API (#1603)
Browse files Browse the repository at this point in the history
Co-authored-by: Michi Hoffmann <[email protected]>
  • Loading branch information
stayallive and cleptric authored Oct 30, 2023
1 parent ab2e11f commit fc5853f
Showing 1 changed file with 12 additions and 3 deletions.
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

0 comments on commit fc5853f

Please sign in to comment.