-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cmd/sentry/send_test_event): Creare
slu sentry sent-test-event
…
… for simple Sentry testing #201
- Loading branch information
1 parent
a106a48
commit afe0edf
Showing
5 changed files
with
63 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package send_test_event | ||
|
||
import ( | ||
"log" | ||
"time" | ||
|
||
"github.com/getsentry/sentry-go" | ||
parent_cmd "github.com/sikalabs/slu/cmd/sentry" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var Cmd = &cobra.Command{ | ||
Use: "send-test-event <sentry_dsn>", | ||
Short: "Send test event to Sentry", | ||
Args: cobra.ExactArgs(1), | ||
Run: func(c *cobra.Command, args []string) { | ||
send(args[0]) | ||
}, | ||
} | ||
|
||
func init() { | ||
parent_cmd.Cmd.AddCommand(Cmd) | ||
} | ||
|
||
func send(dsn string) { | ||
err := sentry.Init(sentry.ClientOptions{ | ||
Dsn: dsn, | ||
Debug: true, | ||
}) | ||
if err != nil { | ||
log.Fatalf("sentry.Init: %s", err) | ||
} | ||
defer sentry.Flush(2 * time.Second) | ||
|
||
sentry.CaptureMessage("It works!") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package sentry | ||
|
||
import ( | ||
"github.com/sikalabs/slu/cmd/root" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var Cmd = &cobra.Command{ | ||
Use: "sentry", | ||
Short: "Sentry utils", | ||
} | ||
|
||
func init() { | ||
root.RootCmd.AddCommand(Cmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters