@@ -30,6 +30,15 @@ To use it, declare it as a service:
3030 services :
3131 Symfony\Bridge\Monolog\Handler\ElasticsearchLogstashHandler : ~
3232
33+ # optionally, configure the handler using the constructor arguments (shown values are default)
34+ Symfony\Bridge\Monolog\Handler\ElasticsearchLogstashHandler : ~
35+ arguments :
36+ $endpoint : " http://127.0.0.1:9200"
37+ $index : " monolog"
38+ $client : null
39+ $level : !php/const Monolog\Logger::DEBUG
40+ $bubble : true
41+
3342 .. code-block :: xml
3443
3544 <!-- config/services.xml -->
@@ -44,16 +53,37 @@ To use it, declare it as a service:
4453
4554 <services >
4655 <service id =" Symfony\Bridge\Monolog\Handler\ElasticsearchLogstashHandler" />
56+
57+ <!-- optionally, configure the handler using the constructor arguments (shown values are default) -->
58+ <service id =" Symfony\Bridge\Monolog\Handler\ElasticsearchLogstashHandler" >
59+ <argument key =" endpoint" >http://127.0.0.1:9200</argument >
60+ <argument key =" index" >monolog</argument >
61+ <argument key =" client" />
62+ <argument key =" level" type =" constant" >Monolog\Logger::DEBUG</argument >
63+ <argument key =" bubble" >true</argument >
64+ </service >
4765 </services >
4866 </container >
4967
5068 .. code-block :: php
5169
5270 // config/services.php
71+ use Monolog\Logger;
5372 use Symfony\Bridge\Monolog\Handler\ElasticsearchLogstashHandler;
5473
5574 $container->register(ElasticsearchLogstashHandler::class);
5675
76+ // optionally, configure the handler using the constructor arguments (shown values are default)
77+ $container->register(ElasticsearchLogstashHandler::class)
78+ ->setArguments(
79+ '$endpoint' => "http://127.0.0.1:9200",
80+ '$index' => "monolog",
81+ '$client' => null,
82+ '$level' => Logger::DEBUG,
83+ '$bubble' => true,
84+ )
85+ ;
86+
5787 Then reference it in the Monolog configuration:
5888
5989.. configuration-block ::
0 commit comments