diff options
Diffstat (limited to 'internal/cli/health_check.go')
-rw-r--r-- | internal/cli/health_check.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/internal/cli/health_check.go b/internal/cli/health_check.go index 14b2c569..bea886e1 100644 --- a/internal/cli/health_check.go +++ b/internal/cli/health_check.go @@ -4,11 +4,12 @@ package cli // import "miniflux.app/v2/internal/cli" import ( + "fmt" + "log/slog" "net/http" "time" "miniflux.app/v2/internal/config" - "miniflux.app/v2/internal/logger" ) func doHealthCheck(healthCheckEndpoint string) { @@ -16,18 +17,18 @@ func doHealthCheck(healthCheckEndpoint string) { healthCheckEndpoint = "http://" + config.Opts.ListenAddr() + config.Opts.BasePath() + "/healthcheck" } - logger.Debug(`Executing health check on %s`, healthCheckEndpoint) + slog.Debug("Executing health check request", slog.String("endpoint", healthCheckEndpoint)) client := &http.Client{Timeout: 3 * time.Second} resp, err := client.Get(healthCheckEndpoint) if err != nil { - logger.Fatal(`Health check failure: %v`, err) + printErrorAndExit(fmt.Errorf(`health check failure: %v`, err)) } defer resp.Body.Close() if resp.StatusCode != 200 { - logger.Fatal(`Health check failed with status code %d`, resp.StatusCode) + printErrorAndExit(fmt.Errorf(`health check failed with status code %d`, resp.StatusCode)) } - logger.Debug(`Health check is OK`) + slog.Debug(`Health check is passing`) } |