mirror of
https://github.com/eosswedenorg/antelope-api-healthcheck
synced 2026-06-18 05:00:03 +02:00
src/server.go: in onTcpMessage() cleanup logging calls using api.LogParams Add and Combine functions.
This commit is contained in:
parent
8079962be8
commit
c168e263df
1 changed files with 5 additions and 4 deletions
|
|
@ -2,6 +2,7 @@ package main
|
|||
|
||||
import (
|
||||
"strings"
|
||||
"github.com/eosswedenorg/eosio-api-healthcheck/src/api"
|
||||
"github.com/eosswedenorg-go/haproxy/agentcheck"
|
||||
"github.com/eosswedenorg-go/tcp_server"
|
||||
)
|
||||
|
|
@ -25,14 +26,14 @@ func onTcpMessage(c *tcp_server.Client, args string) {
|
|||
|
||||
status, msg := healthCheckApi.Call()
|
||||
|
||||
logger.Info("API Check", append([]interface{}{
|
||||
"status", strings.TrimSpace(status.String())},
|
||||
healthCheckApi.LogInfo().ToSlice()...)...)
|
||||
params := api.LogParams{}
|
||||
params.Add("status", strings.TrimSpace(status.String()))
|
||||
|
||||
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
|
||||
c.WriteString(status.String())
|
||||
c.Close()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue