@@ -30,6 +30,15 @@ To use it, declare it as a service:
30
30
services :
31
31
Symfony\Bridge\Monolog\Handler\ElasticsearchLogstashHandler : ~
32
32
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
+
33
42
.. code-block :: xml
34
43
35
44
<!-- config/services.xml -->
@@ -44,16 +53,37 @@ To use it, declare it as a service:
44
53
45
54
<services >
46
55
<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 >
47
65
</services >
48
66
</container >
49
67
50
68
.. code-block :: php
51
69
52
70
// config/services.php
71
+ use Monolog\Logger;
53
72
use Symfony\Bridge\Monolog\Handler\ElasticsearchLogstashHandler;
54
73
55
74
$container->register(ElasticsearchLogstashHandler::class);
56
75
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
+
57
87
Then reference it in the Monolog configuration:
58
88
59
89
.. configuration-block ::
0 commit comments