From 3df4d9ea244b4e4f9273cea465fb51e347bc92e2 Mon Sep 17 00:00:00 2001 From: Antoine Makdessi Date: Tue, 6 Oct 2020 17:57:30 +0200 Subject: [PATCH 1/4] Document usage of Symfony Mailer for error email Related to https://github.com/symfony/monolog-bundle/pull/354 --- logging/monolog_email.rst | 49 +++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/logging/monolog_email.rst b/logging/monolog_email.rst index 5d172ca0428..cfa2730265f 100644 --- a/logging/monolog_email.rst +++ b/logging/monolog_email.rst @@ -4,10 +4,9 @@ How to Configure Monolog to Email Errors ======================================== -.. caution:: +.. versionadded:: 3.6.0 - This feature is not compatible yet with the new :doc:`Symfony mailer `, - so it requires using SwiftMailer. + Support for emailing errors using :doc:`Symfony mailer ` was added in MonologBundle 3.6.0. `Monolog`_ can be configured to send an email when an error occurs within an application. The configuration for this requires a few nested handlers @@ -33,9 +32,9 @@ it is broken down. handler: deduplicated deduplicated: type: deduplication - handler: swift - swift: - type: swift_mailer + handler: symfony_mailer + symfony_mailer: + type: symfony_mailer from_email: 'error@example.com' to_email: 'error@example.com' # or list of recipients @@ -73,11 +72,11 @@ it is broken down. [ 'type' => 'deduplication', - 'handler' => 'swift', + 'handler' => 'symfony_mailer', ], - 'swift' => [ - 'type' => 'swift_mailer', + 'symfony_mailer' => [ + 'type' => 'symfony_mailer', 'from_email' => 'error@example.com', 'to_email' => 'error@example.com', // or a list of recipients @@ -162,7 +161,7 @@ You can adjust the time period using the ``time`` option: type: deduplication # the time in seconds during which duplicate entries are discarded (default: 60) time: 10 - handler: swift + handler: symfony_mailer .. code-block:: xml @@ -172,7 +171,7 @@ You can adjust the time period using the ``time`` option: + handler="symfony_mailer"/> .. code-block:: php @@ -184,12 +183,12 @@ You can adjust the time period using the ``time`` option: 'type' => 'deduplication', // the time in seconds during which duplicate entries are discarded (default: 60) 'time' => 10, - 'handler' => 'swift', + 'handler' => 'symfony_mailer', ], ], ]); -The messages are then passed to the ``swift`` handler. This is the handler that +The messages are then passed to the ``symfony_mailer`` handler. This is the handler that actually deals with emailing you the error. The settings for this are straightforward, the to and from addresses, the formatter, the content type and the subject. @@ -217,9 +216,9 @@ get logged on the server as well as the emails being sent: level: debug deduplicated: type: deduplication - handler: swift - swift: - type: swift_mailer + handler: symfony_mailer + symfony_mailer: + type: symfony_mailer from_email: 'error@example.com' to_email: 'error@example.com' subject: 'An Error Occurred! %%message%%' @@ -259,11 +258,11 @@ get logged on the server as well as the emails being sent: [ 'type' => 'deduplication', - 'handler' => 'swift', + 'handler' => 'symfony_mailer', ], - 'swift' => [ - 'type' => 'swift_mailer', + 'symfony_mailer' => [ + 'type' => 'symfony_mailer', 'from_email' => 'error@example.com', 'to_email' => 'error@example.com', // or a list of recipients From 922932f6c1b32580a19937ab06211e04100cd8fc Mon Sep 17 00:00:00 2001 From: Antoine Makdessi Date: Tue, 6 Oct 2020 18:09:46 +0200 Subject: [PATCH 2/4] Makes DOCtor-RST happy Error: You are not allowed to use version "3.6.0". Only major version "5" is allowed. Error: Please only provide ".. versionadded::" if the version is greater/equal "5.0" --- logging/monolog_email.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logging/monolog_email.rst b/logging/monolog_email.rst index cfa2730265f..225bcd923c8 100644 --- a/logging/monolog_email.rst +++ b/logging/monolog_email.rst @@ -4,7 +4,7 @@ How to Configure Monolog to Email Errors ======================================== -.. versionadded:: 3.6.0 +.. versionadded:: 3.6 Support for emailing errors using :doc:`Symfony mailer ` was added in MonologBundle 3.6.0. From d20f07c2e560ffca6790ff3ef54793decb2f637d Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Wed, 7 Oct 2020 08:13:14 +0200 Subject: [PATCH 3/4] Fix: DOXtor-RST --- .doctor-rst.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.doctor-rst.yaml b/.doctor-rst.yaml index f3ac893b0cd..3051b9325f4 100644 --- a/.doctor-rst.yaml +++ b/.doctor-rst.yaml @@ -92,3 +92,4 @@ whitelist: - '.. versionadded:: 0.2' # MercureBundle - 'provides a ``loginUser()`` method to simulate logging in in your functional' - '.. code-block:: twig' + - '.. versionadded:: 3.6' # MonologBundle From 202b9e6834df02d151fb87349e71597973d5e0a1 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Wed, 7 Oct 2020 08:13:50 +0200 Subject: [PATCH 4/4] Update message --- logging/monolog_email.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logging/monolog_email.rst b/logging/monolog_email.rst index 225bcd923c8..2a07a08f706 100644 --- a/logging/monolog_email.rst +++ b/logging/monolog_email.rst @@ -6,7 +6,7 @@ How to Configure Monolog to Email Errors .. versionadded:: 3.6 - Support for emailing errors using :doc:`Symfony mailer ` was added in MonologBundle 3.6.0. + Support for emailing errors using :doc:`Symfony mailer ` was added in MonologBundle 3.6. `Monolog`_ can be configured to send an email when an error occurs within an application. The configuration for this requires a few nested handlers