Skip to content

feat: add defaultAsBreadcrumb option #5

New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

bawahakim
Copy link

@bawahakim bawahakim commented Mar 6, 2024

Motivation

Currently, all logs are sent by default to Sentry, unless we explictly pass true to asBreadcrumb to the logger method. This is impractical, and also causes issues for framework level log (such as nestjs route explorer).

Solution

Introduce a non-breaking defaultAsBreadcrumb option. It takes in a non-error level log array to define which method should default to breadcrumb (in opposition to capturing an event)

Example Usage

SentryModule.forRoot({
      dsn:  // DSN
      enabled: true,
      defaultAsBreadcrumb: ['warn', 'log', 'debug', 'verbose'],
    }),

Caveats

The SentryServiceInstance method returns a new SentryService in which the options are undefined. To fix, it was necessary to set the instance in the constructor (when the options have been specified). This seems to work well but unsure of any side-effects within the package

@ntegral
Copy link

ntegral commented Mar 11, 2024

@bawahakim - Thanks for creating the PR. I'll review this and look to get it added before the end of the week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants