Skip to content

Commit

Permalink
Fixing route_path issue
Browse files Browse the repository at this point in the history
  • Loading branch information
JustSteveKing committed May 26, 2024
1 parent e761557 commit 73eae25
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
9 changes: 5 additions & 4 deletions src/Factories/DataFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Route;
use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
use Throwable;
use Treblle\Utils\DataObjects\Data;
Expand Down Expand Up @@ -37,7 +38,7 @@ public function make(Request $request, JsonResponse|Response|SymfonyResponse $re
try {
$responseBody = $this->masker->mask(
(array) json_decode(
$response->getContent(),
(string) $response->getContent(),
true,
512,
JSON_THROW_ON_ERROR
Expand Down Expand Up @@ -85,8 +86,8 @@ public function make(Request $request, JsonResponse|Response|SymfonyResponse $re
Carbon::now('UTC')->format('Y-m-d H:i:s'),
(string) $request->ip(),
$request->fullUrl(),
$request->route()?->getName(),
strval($request->userAgent()),
Route::getRoutes()->match($request)->action['as'] ?? null,
(string) $request->userAgent(),
Method::from(
$request->method(),
),
Expand All @@ -111,7 +112,7 @@ public function make(Request $request, JsonResponse|Response|SymfonyResponse $re
)->toArray(),
),
$response->getStatusCode(),
strlen($response->getContent()),
\strlen((string) $response->getContent()),
$loadTime,
$responseBody,
),
Expand Down
6 changes: 2 additions & 4 deletions src/Treblle.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use Illuminate\Support\Facades\Http;
use Treblle\Exceptions\ConfigurationException;
use Treblle\Exceptions\TreblleApiException;
use Treblle\Http\Endpoint;
use Treblle\Utils\DataObjects\Data;

Expand All @@ -19,17 +18,16 @@ final class Treblle
/**
* Send request and response payload to Treblle for processing.
*
* @throws ConfigurationException|TreblleApiException
* @throws ConfigurationException
*/
public static function log(Endpoint $endpoint, Data $data, string $projectId = null): void
public static function log(Endpoint $endpoint, Data $data, ?string $projectId = null): void
{
$treblleConfig = (array) config('treblle');

if ($treblleConfig['project_id'] === null || $treblleConfig['api_key'] === null) {
return;
}


/** @var string $appEnvironment */
$appEnvironment = config('app.env', 'unknownEnvironment');

Expand Down

0 comments on commit 73eae25

Please sign in to comment.