From 2c78ca1cb6436d0a46ba3af23b1f399b65614e73 Mon Sep 17 00:00:00 2001 From: thomasoca Date: Sat, 13 May 2023 22:14:53 +0700 Subject: [PATCH] fix: reduce health check log when healthy --- pkg/app/handlers.go | 6 +++++- pkg/generator/resume.go | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/app/handlers.go b/pkg/app/handlers.go index 2281d37..1bdaed4 100644 --- a/pkg/app/handlers.go +++ b/pkg/app/handlers.go @@ -125,8 +125,12 @@ func (h *HttpHandlers) HealthCheckHandler(w http.ResponseWriter, r *http.Request if err != nil { log.Printf("Server is not healthy") w.WriteHeader(http.StatusInternalServerError) + w.Header().Set("Content-type", "application/json") + _, err = w.Write([]byte(`{"message": "Failed processing file"}`)) + if err != nil { + log.Panic(err) + } return } w.WriteHeader(http.StatusOK) - log.Println(w, "OK") } diff --git a/pkg/generator/resume.go b/pkg/generator/resume.go index 2d9bab8..58e0097 100644 --- a/pkg/generator/resume.go +++ b/pkg/generator/resume.go @@ -38,6 +38,5 @@ func CheckVersion() error { log.Println(out.String()) return errors.New("latex backend not available") } - log.Println("Latex backend available") return err }