Go HTTP client for the nfo centralized logging service.
NfoLog() — send a log entry to nfo-service via HTTP POSTNfoLogBatch() — send multiple entries in one requestNfoQuery() — query logs from the serviceNFO_URL environment variableStart the HTTP service first:
python examples/http-service/main.py
cd examples/go-client
go run main.go
type LogEntry struct {
Cmd string `json:"cmd"`
Args []string `json:"args"`
Lang string `json:"language"`
}
func NfoLog(cmd string, args ...string) {
entry := LogEntry{Cmd: cmd, Args: args, Lang: "go"}
jsonData, _ := json.Marshal(entry)
http.Post(nfoURL+"/log", "application/json",
bytes.NewBuffer(jsonData))
}