Skip to content

Commit

Permalink
Merge pull request #6 from 7Lab/Refactor
Browse files Browse the repository at this point in the history
Refactor of code to use only LAB_TOKEN & LAB_BASE_URL
  • Loading branch information
nielskramerr authored Aug 31, 2020
2 parents 64d5aaf + 57ce46a commit 56c6c44
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
5 changes: 2 additions & 3 deletions config/remote-logging.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 5 additions & 4 deletions src/RemoteLogging.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down Expand Up @@ -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) { }
Expand Down

0 comments on commit 56c6c44

Please sign in to comment.