diff --git a/config/remote-logging.php b/config/remote-logging.php index 45a08a6..48a2757 100644 --- a/config/remote-logging.php +++ b/config/remote-logging.php @@ -13,10 +13,9 @@ 'token' => env('LAB_TOKEN'), /* - * Specify the url that will be used for remote logging. + * Specify the base url that will be used. */ - 'error-url' => env('REMOTELOGGING_ERROR_URL'), - 'failed-job-url' => env('REMOTELOGGING_FAILED_JOB_URL'), + 'url' => env('LAB_BASE_URL'), /* * The exceptions that should be excluded from remote logging. diff --git a/src/RemoteLogging.php b/src/RemoteLogging.php index 92b8da1..076fda5 100644 --- a/src/RemoteLogging.php +++ b/src/RemoteLogging.php @@ -15,6 +15,7 @@ public function __construct() { $this->enabled = config('remote-logging.enabled'); $this->client = new Client([ + 'base_uri' => config('remote-logging.url'), 'headers' => [ 'Accept' => 'application/json', 'Authorization' => 'Bearer ' . config('remote-logging.token'), @@ -57,18 +58,18 @@ public function captureException(Exception $exception) 'url' => request()->fullUrl(), ]; - $this->sendTo(config('remote-logging.error-url'), $data); + $this->sendTo('projects/error/logs', $data); } public function sendFailedJob($data) { - $this->sendTo(config('remote-logging.failed-job-url'), $data); + $this->sendTo('projects/error/failed-job', $data); } - protected function sendTo($url, $data) + protected function sendTo($path, $data) { try { - $this->client->post($url, [ + $this->client->post($path, [ 'form_params' => $data ]); } catch (Exception $e) { }