errtracker-lib
TypeScript icon, indicating that this package has built-in type declarations

0.1.8 • Public • Published

ErrTracker Library

Build Status Coverage Status

Usage scenarios

  1. Report to slack every error. Might create some slack distractions.
  2. Report first of its kind error only. Per device. Since the info about errors are kept in device's localstorage (if supported).
  3. Report every error and store it in AWS. Working on it.

Config

Slack details

Parameter name type (default value) mandatory description
webHookUrl string true slack webhook generated by slack
useConsoleLogger boolean (false) false false
details object false details you might need to provide

AWS example

Parameter name type mandatory description
apiKey string true header api key - granting access to api (generated on request, for now)
token string true id to store error
useConsoleLogger boolean false report about server side response, can provide custom logger
url string false where error was thrown
details object false details you might need to provide

Config samples

Slack every error report

  <script src="/path/to/errtracker-slack-lib.es5.js"></script>
  <script>
    (function(et, d, n) {
      if (!et) {
        return
      }

      et({
        webHookUrl: 'https://hooks.slack.com/services/some_unique_id',
        details: {
          platform: n.platform,
          userAgent: n.userAgent,
          url: d.location
        }
      });
    })(window['slackErrTracker'], window.document, window.navigator);
  </script>

Slack unique error report only example

<script src="/path/to/errtracker-unique-slack-lib.es5.js"></script>
<script>
  (function(et, d, n) {
    if (!et) {
      return
    }

    et({
      webHookUrl: 'https://hooks.slack.com/services/some_unique_id',
      details: {
        platform: n.platform,
        userAgent: n.userAgent,
        url: d.location
      }
    });
  })(window['uniqueSlackErrTracker'], window.document, window.navigator);
</script>

AWS example

<script src="/path/to/errtracker-lib.es5.js"></script>
<script>
(function(et, d, n) {
  if (!et) {
    return
  }
  et({
    // mandatory
    apiKey: 'xxxx-xxxx-xxxx',
    token: 'xxxxxx-xxxx-xx-xxx-xxxxxxxxx',
    // below are optional
    useConsoleLogger: true,
    url: d.location,
    details: {
      platform: n.platform,
      userAgent: n.userAgent
    }
  });
})(window['errtracker'], window.document, window.navigator);
</script>

Package Sidebar

Install

npm i errtracker-lib

Weekly Downloads

0

Version

0.1.8

License

MIT

Unpacked Size

117 kB

Total Files

30

Last publish

Collaborators

  • vandriesh