Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Added documentation about logging levels and extra data. #8

wants to merge 2 commits into
Jump to file or symbol
Failed to load files and symbols.
+26 −1
@@ -46,6 +46,32 @@ client.captureError(new Error('Broke!'), function(result) {
__Note__: `client.captureMessage` will also return the result directly without the need for a callback, such as: `var result = client.captureMessage('Hello, world!');`
+## Additional data
+You might want to send additional data to sentry, which will help to understand the error. Therefore you should use `extra` property of the object passed as a second optional parameter. If you add user specific data to the message, event will not grouped by sentry.
+client.captureMessage('Hello, world!', {extra: {userId: 123}}, function(result) {
+ console.log(client.getIdent(result));
+client.captureError(new Error('Broke!'), {extra: {userId: 123}});
+## Logging levels
+You can specify a level in the second optional parameter. Default level is `error`.
+There are 5 logging levels (in order):
+- debug (the least serious)
+- info
+- warning
+- error
+- fatal (the most serious)
+client.captureMessage('Hello, world!', {level: 'info'}, function(result) {
+ console.log(client.getIdent(result));
+client.captureError(new Error('Broke!'), {level: 'fatal'});
## Events
If you really care if the event was logged or errored out, Client emits two events, `logged` and `error`:
@@ -58,7 +84,6 @@ client.on('error', function(){
## Environment variables
`NODE_ENV` must be set to `production` for Sentry to actually work. Without being in production, a warning is issued and logging disabled.