PHP code example of whchi / laravel-kafkalogger
1. Go to this page and download the library: Download whchi/laravel-kafkalogger library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
whchi / laravel-kafkalogger example snippets
'channels' => [
...
'kafka' => [
'driver' => 'custom',
'via' => \App\Logging\KafkaHandler::class,
],
...
]
namespace App\Logging;
use Monolog\Logger;
class KafkaHandler
{
public function __invoke()
{
$logger = new Logger('custom');
$logger->pushHandler(resolve('KafkaLogger'));
return $logger;
}
}
bash
php artisan vendor:publish --provider="Whchi\KafkaLogger\KafkaLogServiceProvider"
bash
LOG_CHANNEL=kafka