Skip to content

Commit 762f73b

Browse files
committed
Merge branch '4.4' into 5.4
* 4.4: Example remote ElasticsearchLogstashHandler [Validator] Add hint for testing custom constraints
2 parents 61cd54d + fcb9e8f commit 762f73b

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

logging/handlers.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)