使用Symfony和Monolog,我的设置如下
yml
monolog:
handlers:
main:
type: fingers_crossed
action_level: error
handler: grouped
grouped:
type: group
members: [streamed, buffered]
streamed:
type: stream
path: '%kernel.logs_dir%/%kernel.environment%.log'
level: debug
buffered:
type: buffer
handler: swift
swift:
type: swift_mailer
from_email: 'mail@example.com'
to_email: 'mail@example.com'
subject: An error has occured! [Monolog > config_prod.yml]
level: debug
我还使用c975L/ExceptionCheckerBundle避免记录定义的URL(代替使用excluded_404s
)。我想在此捆绑包中添加ignored
URL的大小写。如果一个URL被调用但被标记为ignored
,我希望抛出异常,但不发送电子邮件。
我知道如何向日志中添加信息,如何停止Event的传播,如何清除日志缓冲区,我也知道可以将Monolog配置为不发送电子邮件或调整调试级别,但是我不能找到一种方法(以编程方式)以禁用处理程序以发送电子邮件。我需要的是一种发送有关错误的电子邮件的方法,除了已定义的一些错误,即使将Monolog配置为发送电子邮件,我也需要抛出异常。
那么有可能吗?那是哪一个(如果存在)?