hindsight / php-sdk
Monolog handler and Laravel package for Hindsight
Installs: 6 485
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 4
Forks: 2
Open Issues: 1
Requires
- decahedron/monolog-sticky-context: ^1.0.0
- guzzlehttp/guzzle: ^6.3
- monolog/monolog: ^1.1.3
- ramsey/uuid: ^3.7
README
Installation
composer require hindsight/php-sdk
On Laravel
php artisan vendor:publish --tag=hindsight
- Insert your API key into the
config/hindsight.php
file and configure the remaining options to your liking - Add the
\Hindsight\Middleware\HindsightRequestLogger::class
middleware to the appropriate routes viaapp/Http/Kernel.php
(to add it globally) or in the route files.
Laravel 5.6
On Laravel 5.6, register a new log channel with the hindsight
driver:
'channels' => [ 'stack' => [ 'driver' => 'stack', // Add hindsight to the stack: 'channels' => ['single', 'hindsight'], ], // ... 'hindsight' => [ 'driver' => 'hindsight', ], ],
Laravel < 5.6
If you are on Laravel 5.5, you don't need to do anything, we've automatically registered the service provider and the Hindsight logger.
If you are on Laravel 5.4 or earlier, add the Hindsight\Providers\HindsightServiceProvider::class
to your config/app.php
.
Without Laravel
If you are not using Laravel, you may manually configure your Monolog instance to start sending logs to Hindsight. For convenience, we have a configuration class that you may use:
use Hindsight\Hindsight; Hindsight::setup($monologInstance, $yourApiKey);
If you wish to have a non-standard configuration, you may manually push the Hindsight\Monolog\HindsightMonologHandler
onto your Monolog instance.