PHP code example of atrapalo / monolog-elasticsearch
1. Go to this page and download the library: Download atrapalo/monolog-elasticsearch 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/ */
atrapalo / monolog-elasticsearch example snippets
use Atrapalo\Monolog\Handler\ElasticsearchHandler;
use Elasticsearch\ClientBuilder;
use Monolog\Logger;
$logger = new Logger('application');
$logger->pushHandler(
new ElasticsearchHanler($client, ['index' => 'logs', 'type' => 'log'])
);
bash
php bin/phpunit