From 2ea945a04048601b3205d1f6ce540d39fef54410 Mon Sep 17 00:00:00 2001 From: Aine Date: Wed, 28 Feb 2024 00:47:00 +0200 Subject: [PATCH] set breadcrumb type and timestamp from event --- writer.go | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/writer.go b/writer.go index a8a6527..0639ea1 100644 --- a/writer.go +++ b/writer.go @@ -49,11 +49,21 @@ func (w *Writer) addBreadcrumb(event *sentry.Event) { } } + var breadcrumbType string + switch event.Level { + case sentry.LevelFatal, sentry.LevelError: + breadcrumbType = "error" + default: + breadcrumbType = "default" + } + w.hub.AddBreadcrumb(&sentry.Breadcrumb{ - Category: category, - Message: event.Message, - Level: event.Level, - Data: event.Extra, + Type: breadcrumbType, + Category: category, + Message: event.Message, + Level: event.Level, + Data: event.Extra, + Timestamp: event.Timestamp, }, nil) }