Warning
The Coralogix PHP SDK will End of Life(EOL) Feb 1st 2024.
For PHP 7.4+, please use the Coralogix’s PHP OpenTelemetry Instrumentation Documentation instead.
Laravel integration¶
For using our logger with Laravel
you should to edit your config/logging.php file and add our handler:
use Coralogix\Handlers\CoralogixMonologHandler;
return [
'stack' => [
'driver' => 'stack',
'channels' => ['single', 'coralogix'],
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
],
//....
'coralogix' => [
'driver' => 'monolog',
'handler' => Coralogix\Handlers\CoralogixMonologHandler::class,
'handler_with' => [
'private_key' => '[YOUR_PRIVATE_KEY_HERE]',
'app_name' => '[YOUR_APPLICATION_NAME]',
'subsystem' => '[YOUR_SUBSYSTEM_NAME]'
],
],
];
And then you can send log messages with:
Log::info("Your message");