Skip to content

Commit

Permalink
Send mails with error information to site administrator
Browse files Browse the repository at this point in the history
Fixes #136
  • Loading branch information
TomaszGasior committed Jun 3, 2021
1 parent d163fc2 commit 33ec150
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .env.prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
MAILER_DSN="native://default"
ERROR_LOG_MAIL="error@radiolista.pl"
21 changes: 19 additions & 2 deletions config/packages/prod/monolog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,30 @@ monolog:
main:
type: fingers_crossed
action_level: error
handler: nested
handler: group
excluded_http_codes: [404, 405]
buffer_size: 50 # How many messages should be saved? Prevent memory leaks
nested:
group:
type: group
members: [file, mail_deduplicate]

file:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug

mail_deduplicate:
type: deduplication
handler: mail_send
mail_send:
type: symfony_mailer
from_email: '%env(ERROR_LOG_MAIL)%'
to_email: '%env(ERROR_LOG_MAIL)%'
subject: '%%message%%'
level: debug
formatter: monolog.formatter.html
content_type: text/html

console:
type: console
process_psr_3_messages: false
Expand Down

0 comments on commit 33ec150

Please sign in to comment.