Skip to content

Commit

Permalink
Merge pull request #23 from andygrunwald/add-support-AttachStacktrace
Browse files Browse the repository at this point in the history
Sentry: Add support for `AttachStacktrace`
  • Loading branch information
archdx authored Oct 31, 2024
2 parents 23a939c + b3f2e47 commit 44d77de
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ type config struct {
flushTimeout time.Duration
beforeSend sentry.EventProcessor
tracesSampleRate float64
attachStacktrace bool
}

// WithLevels configures zerolog levels that have to be sent to Sentry.
Expand Down Expand Up @@ -305,6 +306,13 @@ func WithTracingSampleRate(tsr float64) WriterOption {
})
}

// WithAttachStacktrace enabled AttachStacktrace.
func WithAttachStacktrace() WriterOption {
return optionFunc(func(cfg *config) {
cfg.attachStacktrace = true
})
}

// WithBeforeSend sets a callback which is called before event is sent.
func WithBeforeSend(beforeSend sentry.EventProcessor) WriterOption {
return optionFunc(func(cfg *config) {
Expand Down Expand Up @@ -378,6 +386,7 @@ func New(dsn string, opts ...WriterOption) (*Writer, error) {
MaxErrorDepth: cfg.maxErrorDepth,
BeforeSend: cfg.beforeSend,
TracesSampleRate: cfg.tracesSampleRate,
AttachStacktrace: cfg.attachStacktrace,
})
if err != nil {
return nil, err
Expand Down

0 comments on commit 44d77de

Please sign in to comment.