diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2023-09-21 12:43:45 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2023-09-21 14:27:36 +0300 |
commit | e7c2d0a0b2409d11200eef7f9c728eb122639a99 (patch) | |
tree | 84abeb966213b405966fcec2d00f7353ae92cc8a /cmd/gitaly-wrapper | |
parent | df1c19c6b7a16a2179f201c5e821c062fb0d0214 (diff) |
log: Remove Fatal and related functions from `Logger` interface
Remove `Fatal` and related functions. The "fatal" level is not known to
the `slog` package and thus cannot be emulated easily. Replace all such
existing calls with a log message at "error" level followed by exiting
with an error code.
Diffstat (limited to 'cmd/gitaly-wrapper')
-rw-r--r-- | cmd/gitaly-wrapper/main.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/cmd/gitaly-wrapper/main.go b/cmd/gitaly-wrapper/main.go index 59b3b72d6..fda9d04c0 100644 --- a/cmd/gitaly-wrapper/main.go +++ b/cmd/gitaly-wrapper/main.go @@ -36,7 +36,8 @@ func main() { logger = logger.WithField("wrapper", os.Getpid()) if len(os.Args) < 2 { - logger.Fatalf("usage: %s forking_binary [args]", os.Args[0]) + logger.Errorf("usage: %s forking_binary [args]", os.Args[0]) + os.Exit(1) } binary, arguments := os.Args[1], os.Args[2:] @@ -45,13 +46,15 @@ func main() { pidFilePath := os.Getenv(bootstrap.EnvPidFile) if pidFilePath == "" { - logger.Fatalf("missing pid file ENV variable %q", bootstrap.EnvPidFile) + logger.Errorf("missing pid file ENV variable %q", bootstrap.EnvPidFile) + os.Exit(1) } logger.WithField("pid_file", pidFilePath).Info("finding process") process, err := findProcess(pidFilePath) if err != nil && !isRecoverable(err) { - logger.WithError(err).Fatal("find process") + logger.WithError(err).Errorf("find process") + os.Exit(1) } else if err != nil { logger.WithError(err).Error("find process") } @@ -63,7 +66,8 @@ func main() { proc, err := spawnProcess(logger, binary, arguments) if err != nil { - logger.WithError(err).Fatal("spawn gitaly") + logger.WithError(err).Errorf("spawn gitaly") + os.Exit(1) } process = proc |