@@ -26,6 +26,15 @@ To use it, declare it as a service:
26
26
services :
27
27
Symfony\Bridge\Monolog\Handler\ElasticsearchLogstashHandler : ~
28
28
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
+
29
38
.. code-block :: xml
30
39
31
40
<!-- config/services.xml -->
@@ -40,16 +49,37 @@ To use it, declare it as a service:
40
49
41
50
<services >
42
51
<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 >
43
61
</services >
44
62
</container >
45
63
46
64
.. code-block :: php
47
65
48
66
// config/services.php
67
+ use Monolog\Logger;
49
68
use Symfony\Bridge\Monolog\Handler\ElasticsearchLogstashHandler;
50
69
51
70
$container->register(ElasticsearchLogstashHandler::class);
52
71
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
+
53
83
Then reference it in the Monolog configuration:
54
84
55
85
.. configuration-block ::
0 commit comments