Skip to content

Commit

Permalink
Merge pull request #44 from rstcruzo/master
Browse files Browse the repository at this point in the history
Use scope() instead of sentryScope directly when adding breadcrumbs.
  • Loading branch information
TheZeroSlave authored Dec 16, 2023
2 parents 88b0e28 + 024ee37 commit 309e5eb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,15 @@ func (c *core) Write(ent zapcore.Entry, fs []zapcore.Field) error {
clone := c.with(c.addSpecialFields(ent, fs))

// only when we have local sentryScope to avoid collecting all breadcrumbs ever in a global scope
if c.cfg.EnableBreadcrumbs && c.cfg.BreadcrumbLevel.Enabled(ent.Level) && c.sentryScope != nil {
if c.cfg.EnableBreadcrumbs && c.cfg.BreadcrumbLevel.Enabled(ent.Level) && c.scope() != nil {
breadcrumb := sentry.Breadcrumb{
Message: ent.Message,
Data: clone.fields,
Level: sentrySeverity(ent.Level),
Timestamp: ent.Time,
}

c.sentryScope.AddBreadcrumb(&breadcrumb, c.cfg.MaxBreadcrumbs)
c.scope().AddBreadcrumb(&breadcrumb, c.cfg.MaxBreadcrumbs)
}

if c.cfg.Level.Enabled(ent.Level) {
Expand Down

0 comments on commit 309e5eb

Please sign in to comment.