README
@hug/ngx-sentry
Angular wrapper for Sentry JavaScript SDK
Installation
To set up an Angular project with this library use the Angular CLI's installation schematic:
$ ng add @hug/ngx-sentry
The ng add
command will install Sentry dependencies, the HUG Wrapper configuration and ask you the following questions:
Sentry's dsn url:
You can pass your project sentry url (providing during the project creation process) to configure automatically all the Sentry configurations.
The ng add
command will additionally perform the following configurations:
- Add project dependencies to
package.json
- Create the
.sentryclirc
file containing the project configuration - Add Sentry versioning and sourcemap configurations to
package.json
- Allow json module resolving to
tsconfig.json
- Add
sentryUrl
property to yourenvironments.*.ts
files - Import NgxSentryModule to your application module
You're done! Sentry is now configured to be used in your application.
Usage
You can set the current user by using the NgxSentryService provided by the library.
constructor(
private sentryService: NgxSentryService,
) {
this.sentryService.setUser({
email: 'rtrm@hcuge.ch',
username: 'rtrm',
attr1: 'attr1'
});
}
To remove the current user, you can pass null
constructor(
private sentryService: NgxSentryService,
) {
this.sentryService.setUser(null);
}
Development
See the developer docs.
Contributing
Want to Help?
Want to file a bug, contribute some code or improve documentation? Excellent!
But please read up first on the guidelines for contributing, and learn about submission process, coding rules and more.
Code of Conduct
Please read and follow the Code of Conduct, and help us keep this project open and inclusive.
Credits
This library was made with @hug/ngx-lib-and-schematics-starter.