diff --git a/writer.go b/writer.go index af13763..b178675 100644 --- a/writer.go +++ b/writer.go @@ -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. @@ -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) { @@ -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