Nascent Political Miscreant
    Wondering what’s next for npm?Check out our public roadmap! »

    @sentry/minimal
    TypeScript icon, indicating that this package has built-in type declarations

    6.7.0 • Public • Published


    Sentry JavaScript SDK Minimal

    npm version npm dm npm dt typedoc

    Links

    General

    A minimal Sentry SDK 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. If the user is using Sentry in their application and your library uses @sentry/minimal, the user receives all breadcrumbs/messages/events you added to your libraries codebase.

    Usage

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

    import * as Sentry from '@sentry/minimal';
    
    // 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 interfere 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.configureScope(scope => {
      scope.setExtra('battery', 0.7);
      scope.setTag('user_mode', 'admin');
      scope.setUser({ id: '4711' });
      // scope.clear();
    });

    Keywords

    none

    Install

    npm i @sentry/minimal

    DownloadsWeekly Downloads

    2,987,018

    Version

    6.7.0

    License

    BSD-3-Clause

    Unpacked Size

    52.8 kB

    Total Files

    11

    Last publish

    Collaborators

    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar