如何在Airbrake 5中忽略_user_agent?

时间:2015-12-22 19:01:07

标签: airbrake

我们正在迁移到Airbrake 5,我想知道如何替换ignore_user_agent配置的功能。我知道我们必须检查add_filter块,但不确定检查的位置/位置

有没有人有一个替换Airbrake 5中的ignore_user_agent配置选项的例子?

1 个答案:

答案 0 :(得分:2)

这很容易(假设合并this fix并发布新的宝石):

Airbrake.add_filter do |notice|
  notice.ignore! if notice[:context][:userAgent].match(/curl/)
end

与此同时,您可以使用the class add_filter API

来自:https://github.com/airbrake/airbrake-ruby/issues/9

编辑:新宝石已发布。

相关问题