diff --git a/src/functions.php b/src/functions.php index b33863965..9dba70ab1 100644 --- a/src/functions.php +++ b/src/functions.php @@ -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 $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) + ); } /**