Add documentation about using Sentry

This commit is contained in:
Hannu Lyytikainen 2017-10-03 19:03:04 +03:00
parent 65e9889656
commit 6b771153f3
3 changed files with 20 additions and 0 deletions

View file

@ -63,3 +63,7 @@ to deploy a feature branch, setup the `sharetribe-starter-app` Heroku
app and push the feature branch:
git push heroku my-feature-branch:master
## Logging
Starter App has Sentry integration in place as an example of using as external error logging service. For more information see the [logging documentation](docs/sentry.md).

View file

@ -6,3 +6,4 @@ Documentation for specific topics can be found in the following files:
- Original [create-react-app documentation](create-react-app.md)
- [Testing](testing.md)
- [Error logging with Sentry](sentry.md)

15
docs/sentry.md Normal file
View file

@ -0,0 +1,15 @@
# Error logging with Sentry
The Starter App supports error logging with [Sentry](https://sentry.io/) out of the box provided that required environment variables are set in place. Other logging solutions can also be used but the Sentry client comes already strapped into the Starter App.
To enable the Sentry error logging a DSN, _Data Source Name_ has to be provided as an environment variable. Browser and Node environments both require their own keys. The key names are as follows:
- __SERVER_SENTRY_DSN__ - the private Sentry DSN, used on the server side
- __REACT_APP_PUBLIC_SENTRY_DSN__ - the public Sentry DSN, used in the browser
The DSN keys can be aquired from the Sentry project settings. To test them in your local environment they can be passed for example to the `yarn run dev-server` command:
REACT_APP_PUBLIC_SENTRY_DSN='<public-sentry-dsn>' SERVER_SENTRY_DSN='<private-sentry-dsn>' yarn run dev-server
If the Sentry DSN keys are not provided Starter App will log errors to the console. The logging and Sentry setup is implemented in [util/log.js](../src/util/log.js) and [server/log.js](../server/log.js) so refer to those files to change the external logging service or the logging logic in general.