This repository has been archived by the owner on Mar 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat #19: integrate sentry for event reporting
- Loading branch information
Showing
8 changed files
with
165 additions
and
1 deletion.
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
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
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 |
---|---|---|
@@ -1,7 +1,15 @@ | ||
package main | ||
|
||
import "github.com/httprunner/hrp/hrp/cmd" | ||
import ( | ||
"time" | ||
|
||
"github.com/getsentry/sentry-go" | ||
"github.com/httprunner/hrp/hrp/cmd" | ||
) | ||
|
||
func main() { | ||
// Flush buffered events before the program terminates. | ||
defer sentry.Flush(2 * time.Second) | ||
|
||
cmd.Execute() | ||
} |
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 |
---|---|---|
|
@@ -4,10 +4,25 @@ import ( | |
"os" | ||
"strings" | ||
|
||
"github.com/getsentry/sentry-go" | ||
"github.com/rs/zerolog" | ||
zlog "github.com/rs/zerolog/log" | ||
) | ||
|
||
func init() { | ||
// init sentry sdk | ||
err := sentry.Init(sentry.ClientOptions{ | ||
Dsn: "https://[email protected]/6070292", | ||
Release: VERSION, | ||
}) | ||
if err != nil { | ||
log.Fatal().Err(err).Msg("init sentry sdk failed!") | ||
} | ||
sentry.ConfigureScope(func(scope *sentry.Scope) { | ||
scope.SetLevel(sentry.LevelError) | ||
}) | ||
} | ||
|
||
var log = zlog.Logger | ||
|
||
func SetLogLevel(level string) { | ||
|