Improve the presentation of the measurement listing from the CLI
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package crashreport
|
||||
|
||||
import (
|
||||
"github.com/apex/log"
|
||||
"github.com/getsentry/raven-go"
|
||||
)
|
||||
|
||||
@@ -8,13 +9,15 @@ import (
|
||||
// crash reporting logic a no-op.
|
||||
var Disabled = false
|
||||
|
||||
var client *raven.Client
|
||||
|
||||
// CapturePanic is a wrapper around raven.CapturePanic that becomes a noop if
|
||||
// `Disabled` is set to true.
|
||||
func CapturePanic(f func(), tags map[string]string) (interface{}, string) {
|
||||
if Disabled == true {
|
||||
return nil, ""
|
||||
}
|
||||
return raven.CapturePanic(f, tags)
|
||||
return client.CapturePanic(f, tags)
|
||||
}
|
||||
|
||||
// CapturePanicAndWait is a wrapper around raven.CapturePanicAndWait that becomes a noop if
|
||||
@@ -23,7 +26,7 @@ func CapturePanicAndWait(f func(), tags map[string]string) (interface{}, string)
|
||||
if Disabled == true {
|
||||
return nil, ""
|
||||
}
|
||||
return raven.CapturePanicAndWait(f, tags)
|
||||
return client.CapturePanicAndWait(f, tags)
|
||||
}
|
||||
|
||||
// CaptureError is a wrapper around raven.CaptureError
|
||||
@@ -31,7 +34,7 @@ func CaptureError(err error, tags map[string]string) string {
|
||||
if Disabled == true {
|
||||
return ""
|
||||
}
|
||||
return raven.CaptureError(err, tags)
|
||||
return client.CaptureError(err, tags)
|
||||
}
|
||||
|
||||
// CaptureErrorAndWait is a wrapper around raven.CaptureErrorAndWait
|
||||
@@ -39,9 +42,21 @@ func CaptureErrorAndWait(err error, tags map[string]string) string {
|
||||
if Disabled == true {
|
||||
return ""
|
||||
}
|
||||
return raven.CaptureErrorAndWait(err, tags)
|
||||
return client.CaptureErrorAndWait(err, tags)
|
||||
}
|
||||
|
||||
// Wait will block on sending messages to the sentry server
|
||||
func Wait() {
|
||||
if Disabled == false {
|
||||
log.Info("sending exception backtrace")
|
||||
client.Wait()
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
raven.SetDSN("https://cb4510e090f64382ac371040c19b2258:8448daeebfa643c289ef398f8645980b@sentry.io/1234954")
|
||||
var err error
|
||||
client, err = raven.NewClient("https://cb4510e090f64382ac371040c19b2258:8448daeebfa643c289ef398f8645980b@sentry.io/1234954", nil)
|
||||
if err != nil {
|
||||
log.WithError(err).Error("failed to create a raven client")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user