@hug/ngx-sentry

Angular wrapper for Sentry JavaScript SDK

Usage no npm install needed!

<script type="module">
  import hugNgxSentry from 'https://cdn.skypack.dev/@hug/ngx-sentry';
</script>

README

@hug/ngx-sentry


hug-logo

Angular wrapper for Sentry JavaScript SDK

npm version npm donwloads license GPLv3

build status dependency status peerDependency status PRs welcome


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:

  1. 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 your environments.*.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.

love@hug