LoginSignup
0
0

More than 5 years have passed since last update.

faultline-jsでエラーをfaultlineにPOSTしないようにフィルタリングする方法

Last updated at Posted at 2017-09-08

faultline-jsのベースとなっているairbrake-jsには、あまりトラッキングしなくてよいエラーをPOSTしないようにフィルタリングする機構があります。

faultline-jsでも、airbrake-jsと同様に以下のようにフィルタリングを追加することができます。

var faultline = new faultlineJs.Client({ /** ... ** / });

faultline.addFilter(function(notice) {
    if (notice.context.userAgent.match(/bot/i)) {
        // botによるエラーをフィルタリング
        return null;
    }
    if (!notice.context.url.match(/^https:\/\/production.example.com/)) {
        // 本番以外のエラーをフィルタリング
        return null;
    }
    return notice;
});

ご活用下さい

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0