Skip to content

luisfcolon/sentry-toolkit

Repository files navigation

Sentry Toolkit

I have not used this repo in several years. It may or may not work anymore. If anyone wants to help keep it updated please feel free.

No Maintenance Intended 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');

About

Sentry tools and logger

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published