antonioribeiro / health

Laravel Health Panel
BSD 3-Clause "New" or "Revised" License
1.95k stars 197 forks source link

Notification email improvements - error message included and custom subject line #134

Closed EricTendian closed 5 years ago

EricTendian commented 5 years ago

This PR makes two improvements to the notification email:

  1. Previously, the email was only showing the action message in the email, which was something like The '{{ resource }}' service is in trouble and needs attention in {{ url }}. This message was not very helpful as it did not show why something was failing, requiring someone to click to the panel to see. If someone got an email in the middle of the night and went to check the health panel when they woke up, often the error would have cleared and it would be difficult/impossible to track down what the original failure was.

    To fix this, the error message is now included as a new line in the email. If for some reason no error message exists, the email will still send, just with that line omitted.

  2. If this package is used across multiple applications and environments, the subject line for the email is not descriptive as to where the issue occurred.

    To fix this, a user can now set a custom subject in their config by changing the notifications.subject property in the config. They could change it to something like 'subject' => '['.config('app.env').'] '.config('app.name').' Health Status', which provides more info about which health status this is for. If the subject is null (because someone hasn't updated their config file), the name of the notification class will be used.

EricTendian commented 5 years ago

@antonioribeiro hi! When you have a chance, could you take a look at this? Thanks!

EricTendian commented 5 years ago

@antonioribeiro what do you think about these changes?

ezra-obiwale commented 5 years ago

@antonioribeiro Your attention is required here, please!