@sentry/shim
Sentry shim which can be used in libraries
Last updated 7 years ago by jauer .
BSD-3-Clause · Repository · Original npm · Tarball · package.json
$ gnpm install @sentry/shim 
SYNC missed versions from official npm registry.


Sentry JavaScript SDK Shim

npm version npm dm npm dt

A lightweight Sentry SDK shim that uses a configured client when embedded into an application. It allows library authors add support for a Sentry SDK without having to bundle the entire SDK or being dependent on a specific platform.

Usage

To use the shim, you do not have to initialize an SDK. This should be handled by the user of your library. Instead, direcly use the exported functions of @sentry/shim to add breadcrumbs or capture events:

import * as Sentry from '@sentry/shim';

// Add a breadcrumb for future events
Sentry.addBreadcrumb({
  message: 'My Breadcrumb',
  // ...
});

// Capture exceptions, messages or manual events
Sentry.captureMessage('Hello, world!');
Sentry.captureException(new Error('Good bye'));
Sentry.captureEvent({
  message: 'Manual',
  stacktrace: [
    // ...
  ],
});

Note that while strictly possible, it is discouraged to interfer with the event context. If for some reason your library needs to inject context information, beware that this might override the user's context values:

// Set user information, as well as tags and further extras
Sentry.setExtraContext({ battery: 0.7 });
Sentry.setTagsContext({ user_mode: 'admin' });
Sentry.setUserContext({ id: '4711' });

Current Tags

  • 0.5.4                                ...           latest (7 years ago)

11 Versions

  • 0.5.4                                ...           7 years ago
  • 0.5.3                                ...           7 years ago
  • 0.5.2                                ...           7 years ago
  • 0.5.1                                ...           7 years ago
  • 0.5.0                                ...           7 years ago
  • 0.5.0-beta.5                                ...           7 years ago
  • 0.5.0-beta.4                                ...           7 years ago
  • 0.5.0-beta.3                                ...           7 years ago
  • 0.5.0-beta.2                                ...           7 years ago
  • 0.5.0-beta.1                                ...           7 years ago
  • 0.5.0-beta.0                                ...           7 years ago
Downloads
Today 1
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (9)

Copyright 2013 - present © cnpmjs.org | Home |