1. Go to this page and download the library: Download aubes/ecs-logging-bundle 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/ */
aubes / ecs-logging-bundle example snippets
use Elastic\Types\Service;
$service = new Service()
$service->setName(/* [...] */);
$service->setVersion(/* [...] */);
$logger->info('exception.message', [
'service' => new Service(),
]);
$logger->info('message');
use Elastic\Types\Error as EcsError;
try {
// [...]
} catch (\Exception $e) {
$logger->info('exception.message', [
'error' => new EcsError($e),
]);
}
use Elastic\Types\User;
// [...]
$ecsUser = new User();
$ecsUser->setId($userId);
$ecsUser->setName($userName);
$logger->info('exception.message', [
'user' => $ecsUser,
]);
// [...]
$logger->info('message');
// src/Security/CustomEcsUserProvider.php
namespace App\Security;
use Elastic\Types\User;
use Symfony\Component\Security\Core\Security;
class CustomEcsUserProvider implements EcsUserProviderInterface
{
public function getUser(): ?User
{
// [...]
}
public function getDomain(): ?string
{
return 'custom_user_provider';
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.