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.
Sentry tools and logger
With yarn
yarn add sentry-toolkit
With npm
npm install sentry-toolkit --save
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
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();
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');