-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
208 additions
and
144 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
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,33 +1,33 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/cronitorio/cronitor-kubernetes/cmd" | ||
"github.com/getsentry/sentry-go" | ||
log "github.com/sirupsen/logrus" | ||
"log/slog" | ||
"os" | ||
"time" | ||
|
||
"github.com/cronitorio/cronitor-kubernetes/cmd" | ||
"github.com/getsentry/sentry-go" | ||
) | ||
|
||
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) | ||
// Configure slog with JSON handler (or TextHandler if you prefer) | ||
handler := slog.NewTextHandler(os.Stdout, &slog.HandlerOptions{ | ||
Level: slog.LevelInfo, | ||
AddSource: false, | ||
}) | ||
slog.SetDefault(slog.New(handler)) | ||
} | ||
|
||
func main() { | ||
if os.Getenv("SENTRY_ENABLED") == "true" { | ||
log.Info("Enabling Sentry instrumentation...") | ||
slog.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) | ||
slog.Error("sentry initialization failed", "error", err) | ||
os.Exit(1) | ||
} | ||
defer sentry.Flush(2 * time.Second) | ||
defer sentry.Recover() | ||
|
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
Oops, something went wrong.