-
Notifications
You must be signed in to change notification settings - Fork 8
/
main.go
43 lines (37 loc) · 966 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package main
import (
"github.com/cronitorio/cronitor-kubernetes/cmd"
"github.com/getsentry/sentry-go"
log "github.com/sirupsen/logrus"
"os"
"time"
)
func init() {
//log.SetLevel(log.DebugLevel)
// Set to true to see line number information
//log.SetReportCaller(false)
formatter := &log.TextFormatter{
FullTimestamp: true,
}
log.SetFormatter(formatter)
}
func main() {
if os.Getenv("SENTRY_ENABLED") == "true" {
log.Info("Enabling Sentry instrumentation...")
err := sentry.Init(sentry.ClientOptions{
Dsn: "https://[email protected]/6031178",
AttachStacktrace: true,
})
if err != nil {
log.Fatalf("sentry.Init: %s", err)
}
defer sentry.Flush(2 * time.Second)
defer sentry.Recover()
if email := os.Getenv("SUPPORT_EMAIL_ADDRESS"); email != "" {
sentry.ConfigureScope(func(scope *sentry.Scope) {
scope.SetContext("userEmail", email)
})
}
}
cmd.Execute()
}