Skip to content

Commit

Permalink
feat: Add Logging for VATSIM.net Webhooks
Browse files Browse the repository at this point in the history
  • Loading branch information
CalumTowers committed Jan 9, 2025
1 parent f854c66 commit c552843
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,6 @@ BUGSNAG_FILTERS=password,authid,authpassword,apikey_pub,access_token,x-newrelic-
BUGSNAG_BATCH_SENDING=true
BUGSNAG_NOTIFY_RELEASE_STAGES=production,staging
BUGSNAG_QUERY_BINDINGS=true

BETTERSTACK_SOURCE_TOKEN=
BETTERSTACK_LOG_LEVEL=debug
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"league/csv": "^9.0",
"league/oauth2-client": "^2.4",
"livewire/livewire": "^3.5",
"logtail/monolog-logtail": "^3.2",
"maatwebsite/excel": "~3.1.17",
"malahierba-lab/public-id": "dev-main",
"ohdearapp/ohdear-php-sdk": "^3.0",
Expand Down Expand Up @@ -170,4 +171,4 @@
"php-http/discovery": true
}
}
}
}
50 changes: 49 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 11 additions & 2 deletions config/logging.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['daily', 'bugsnag'],
'channels' => ['daily', 'bugsnag', 'betterstack'],
],

'training' => [
Expand All @@ -57,7 +57,7 @@
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => 14,
'days' => 10,
],

'slack' => [
Expand Down Expand Up @@ -114,6 +114,15 @@
'bugsnag' => [
'driver' => 'bugsnag',
],

'betterstack' => [
'driver' => 'monolog',
'level' => env('BETTERSTACK_LOG_LEVEL', 'debug'),
'handler' => Logtail\Monolog\LogtailHandler::class,
'with' => [
'sourceToken' => env('BETTERSTACK_SOURCE_TOKEN'),
],
],
],

];
6 changes: 6 additions & 0 deletions routes/web-external.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
], function () {

Route::post('webhook', function () {
Log::info(print_r([
'Authorization' => request()->header('Authorization'),
'User-Agent' => request()->header('User-Agent'),
'Body' => request()->all(),
], true));

return response()->json([
'status' => 'ok',
]);
Expand Down

0 comments on commit c552843

Please sign in to comment.