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 service- Configurable via
NFO_URLenvironment variable
Start the HTTP service first:
python examples/http-service/main.pycd examples/go-client
go run main.gotype 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))
}