Remove println and replace it with our logging

This commit is contained in:
2023-10-07 13:06:48 +01:00
parent 39d3afdd05
commit 8673f1caf8
7 changed files with 25 additions and 5 deletions
+9 -2
View File
@@ -25,12 +25,19 @@ func StartHTTPProxy() {
server.Get("/healthz", healthCheck)
err := server.Listen(fmt.Sprintf(":%d", cfg.Server.PortGraphQL))
if err != nil {
fmt.Println("Can't start the service: ", err)
cfg.Logger.Critical("Can't start the service", map[string]interface{}{"error": err.Error()})
}
}
func healthCheck(c *fiber.Ctx) error {
return c.SendString("OK")
query := `{ __typename }`
_, err := cfg.Client.GQLClient.Query(query, nil, nil)
if err != nil {
cfg.Logger.Error("Can't reach the GraphQL server", map[string]interface{}{"error": err.Error()})
cfg.Monitoring.Increment(libpack_monitoring.MetricsFailed, nil)
return c.SendStatus(500)
}
return c.SendStatus(200)
}
func processGraphQLRequest(c *fiber.Ctx) error {