This package is a wrapper for sentry library. It allows you to simply use latest Sentry SDK on both client and a server in your meteor application.
This package is MIT Licensed.
meteor add wolas:sentry
The same interface can be used on a client and server.
import Logger from 'meteor/wolas:sentry';
Logger.init({
dsn: YOUR_SENTRY_DSN GOES HERE
//any other options you want to pass to sentry init function
});
import Logger from 'meteor/wolas:sentry';
Logger.info('Something happened', {
userId: getUserId()
});
Logger has methods for all Sentry severity levels, such as:
Logger.error()
Logger.fatal()
Logger.warning()
Logger.info()
Logger.debug()
Logger.critical()
each method has following signature:
function ( event, extra )
Returns: string
- sentry event id.
Param | Type | Description |
---|---|---|
event | Error \ string |
event that is being logged |
extra | object |
any extra params you want to pass |
Any unhandled exceptions that happen on the client or server should be automatically logged to Sentry. Nothing to configure there.
If you wish to postprocess an event somehow - for instance log it to the console, you can pass a custom function in initialization.
import Logger from 'meteor/wolas:sentry';
Logger.init({
dsn: YOUR_SENTRY_DSN GOES HERE,
postprocess: function(level, event, extra) {
console.log(`[${level}] - ${event}`, extra);
}
});