Page MenuHomeDevCentral

D2957.diff
No OneTemporary

D2957.diff

diff --git a/app/Actions/ActionsReport.php b/app/Actions/ActionsReport.php
--- a/app/Actions/ActionsReport.php
+++ b/app/Actions/ActionsReport.php
@@ -2,6 +2,8 @@
namespace Nasqueron\Notifications\Actions;
+use Keruald\OmniTools\Collections\HashMap;
+
class ActionsReport {
/**
* List of actions
@@ -79,6 +81,13 @@
/// Output
///
+ /**
+ * Gets an array representation of the current instance
+ */
+ public function toArray() : array {
+ return HashMap::from($this)->toArray();
+ }
+
/**
* Gets a JSON string representation of the current instance
*/
diff --git a/app/Http/Controllers/Gate/GateController.php b/app/Http/Controllers/Gate/GateController.php
--- a/app/Http/Controllers/Gate/GateController.php
+++ b/app/Http/Controllers/Gate/GateController.php
@@ -2,6 +2,7 @@
namespace Nasqueron\Notifications\Http\Controllers\Gate;
+use Nasqueron\Notifications\Actions\ActionsReport;
use Nasqueron\Notifications\Config\Features;
use Nasqueron\Notifications\Config\Services\Service;
use Nasqueron\Notifications\Facades\Services;
@@ -75,10 +76,21 @@
$report = App::make('report');
$statusCode = $report->containsError() ? 503 : 200;
+
+ $this->logResponse($report, $statusCode);
+
return Response::json($report)
->setStatusCode($statusCode);
}
+ /**
+ * Logs the action reports sent as response by the controller
+ */
+ protected function logResponse (ActionsReport $report, int $statusCode) : void {
+ Log::info("[Gate] Actions report.", $report->toArray());
+ Log::info("[Gate] Response is HTTP $statusCode");
+ }
+
///
/// Credentials
///
diff --git a/composer.json b/composer.json
--- a/composer.json
+++ b/composer.json
@@ -17,6 +17,7 @@
"keruald/github": "^0.2.1",
"keruald/broker": "^0.5.0",
"keruald/mailgun": "^0.1.0",
+ "keruald/omnitools": "^0.8.0",
"netresearch/jsonmapper": "^1.1.1",
"sentry/sentry-laravel": "^3.2"
},

File Metadata

Mime Type
text/plain
Expires
Mon, Oct 7, 16:06 (21 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2180622
Default Alt Text
D2957.diff (1 KB)

Event Timeline