gitlab.com/gitlab-org/labkit@v1.21.0/errortracking/capture_options.go (about)

     1  package errortracking
     2  
     3  import (
     4  	"github.com/getsentry/sentry-go"
     5  )
     6  
     7  // CaptureOption will configure how an error is captured.
     8  type CaptureOption func(*captureConfig, *sentry.Event)
     9  
    10  type captureConfig struct {
    11  	attachStackTrace bool
    12  }
    13  
    14  func applyCaptureOptions(opts []CaptureOption) (captureConfig, *sentry.Event) {
    15  	event := sentry.NewEvent()
    16  	event.Level = sentry.LevelError
    17  
    18  	config := captureConfig{}
    19  
    20  	for _, v := range opts {
    21  		v(&config, event)
    22  	}
    23  
    24  	return config, event
    25  }