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:
parent
8079962be8
commit
c168e263df
1 changed files with 5 additions and 4 deletions
|
|
@ -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()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue