1
0
Fork 0
mirror of https://github.com/eosswedenorg/antelope-api-healthcheck synced 2026-07-04 12:03:43 +02:00

src/server.go: in onTcpMessage() cleanup logging calls using api.LogParams Add and Combine functions.

This commit is contained in:
Henrik Hautakoski 2022-10-26 10:29:25 +02:00
parent 8079962be8
commit c168e263df
No known key found for this signature in database
GPG key ID: 608414D93E862CCD

View file

@ -2,6 +2,7 @@ package main
import ( import (
"strings" "strings"
"github.com/eosswedenorg/eosio-api-healthcheck/src/api"
"github.com/eosswedenorg-go/haproxy/agentcheck" "github.com/eosswedenorg-go/haproxy/agentcheck"
"github.com/eosswedenorg-go/tcp_server" "github.com/eosswedenorg-go/tcp_server"
) )
@ -25,14 +26,14 @@ func onTcpMessage(c *tcp_server.Client, args string) {
status, msg := healthCheckApi.Call() status, msg := healthCheckApi.Call()
logger.Info("API Check", append([]interface{}{ params := api.LogParams{}
"status", strings.TrimSpace(status.String())}, params.Add("status", strings.TrimSpace(status.String()))
healthCheckApi.LogInfo().ToSlice()...)...)
if msg != "OK" && len(msg) > 0 { if msg != "OK" && len(msg) > 0 {
logger.Warn("API Check Failed", "message", msg) params.Add("error", msg)
} }
logger.Info("API Check", params.Combine(healthCheckApi.LogInfo())...)
// Report status to HAproxy // Report status to HAproxy
c.WriteString(status.String()) c.WriteString(status.String())
c.Close() c.Close()