@@ -26,6 +26,15 @@ To use it, declare it as a service:
2626 services :
2727 Symfony\Bridge\Monolog\Handler\ElasticsearchLogstashHandler : ~
2828
29+ # optionally, configure the handler using the constructor arguments (shown values are default)
30+ Symfony\Bridge\Monolog\Handler\ElasticsearchLogstashHandler : ~
31+ arguments :
32+ $endpoint : " http://127.0.0.1:9200"
33+ $index : " monolog"
34+ $client : null
35+ $level : !php/const Monolog\Logger::DEBUG
36+ $bubble : true
37+
2938 .. code-block :: xml
3039
3140 <!-- config/services.xml -->
@@ -40,16 +49,37 @@ To use it, declare it as a service:
4049
4150 <services >
4251 <service id =" Symfony\Bridge\Monolog\Handler\ElasticsearchLogstashHandler" />
52+
53+ <!-- optionally, configure the handler using the constructor arguments (shown values are default) -->
54+ <service id =" Symfony\Bridge\Monolog\Handler\ElasticsearchLogstashHandler" >
55+ <argument key =" endpoint" >http://127.0.0.1:9200</argument >
56+ <argument key =" index" >monolog</argument >
57+ <argument key =" client" />
58+ <argument key =" level" type =" constant" >Monolog\Logger::DEBUG</argument >
59+ <argument key =" bubble" >true</argument >
60+ </service >
4361 </services >
4462 </container >
4563
4664 .. code-block :: php
4765
4866 // config/services.php
67+ use Monolog\Logger;
4968 use Symfony\Bridge\Monolog\Handler\ElasticsearchLogstashHandler;
5069
5170 $container->register(ElasticsearchLogstashHandler::class);
5271
72+ // optionally, configure the handler using the constructor arguments (shown values are default)
73+ $container->register(ElasticsearchLogstashHandler::class)
74+ ->setArguments(
75+ '$endpoint' => "http://127.0.0.1:9200",
76+ '$index' => "monolog",
77+ '$client' => null,
78+ '$level' => Logger::DEBUG,
79+ '$bubble' => true,
80+ )
81+ ;
82+
5383 Then reference it in the Monolog configuration:
5484
5585.. configuration-block ::
0 commit comments