在自定义 Airbrake 通知中传递环境
我已经从与 Rails 应用程序一起运行的 Ruby EM 服务器向 Airbrake 编写了自定义通知。在发生异常的情况下,我按照 API 文档通知 Airbrake
Airbrake.notify(
:error_class => "Ruby EM Server Error:",
:error_message => "EM Server Crashed with error: #{$!}",
:backtrace => $@,
) if ENV['RAILS_ENV'] == 'production'
但是,当错误显示为“未知:EM 服务器因错误而崩溃:”时,
我知道发送通知时的 RAILS_ENV 是什么,所以我想知道是否有什么方法可以将这些信息传递给 Airbrake,而无需编写 XML 并将其发布。
我希望看到错误显示为“生产:EM 服务器因错误而崩溃:”
I've written a custom notification to Airbrake from a Ruby EM server we run along with our Rails app. In the case of an exception, I notify Airbrake as per the API docs
Airbrake.notify(
:error_class => "Ruby EM Server Error:",
:error_message => "EM Server Crashed with error: #{$!}",
:backtrace => $@,
) if ENV['RAILS_ENV'] == 'production'
However, when the error comes through as "Unknown: EM Server Crashed with error:"
I know what the RAILS_ENV is when I send off the notification so I was wondering if there was any way I can pass this info on to Airbrake without writing XML and posting it.
I'd like to see the error to come through as "Production: EM Server Crashed with error:"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个:
environment_name
选项位于gem的文档中。Try this:
The
environment_name
option is in the gem's documentation.