Nutmeg Plundering Muse

    sentry-toolkit

    1.0.4 • Public • Published

    Sentry Toolkit

    Build Status Coverage Status GitHub license NPM downloads GitHub issues

    Overview

    Sentry tools and logger

    Installation

    With yarn

    yarn add sentry-toolkit
    

    With npm

    npm install sentry-toolkit --save
    

    Setup

    Environment variables

    You will need a Sentry account and your Sentry public dsn key. You will need to set that key in your environment file. An example environment file is part of the this repo.

    In the root of your project

    vim .env
    

    There are 2 variables you have to set:

    SENTRY_PUBLIC_DSN

    • You get that from Sentry

    ENV

    • Example: development, qa, staging, production

    Usage

    Bind Sentry to the error console

    Everytime an exception or error is sent to the error console, it will also be sent to your sentry account.

    This should be executed very early in your application; even one of the first things.

    import { bindSentryToErrorConsole } from 'sentry-toolkit';
     
     
    bindSentryToErrorConsole();

    Simple Sentry logging

    You can also send simple log statements to your sentry account.

    import { log } from 'sentry-toolkit';
     
     
    # send an error message
    log.error('some error message');
     
    # send an exception
    log.exception('some exception message');
     
    # send an info message
    log.info('some info message');
     
    # send a warning message
    log.warning('some warning message');

    Keywords

    none

    Install

    npm i sentry-toolkit

    DownloadsWeekly Downloads

    1

    Version

    1.0.4

    License

    MIT

    Last publish

    Collaborators

    • luisfcolon