just make it debug

This commit is contained in:
davidnewhall2 2020-06-22 01:25:44 -07:00
parent e973f4b193
commit ab5d2038fb
1 changed files with 7 additions and 4 deletions

View File

@ -171,9 +171,9 @@ func (u *InputUnifi) RawMetrics(filter *poller.Filter) ([]byte, error) {
switch filter.Kind { switch filter.Kind {
case "d", "device", "devices": case "d", "device", "devices":
return u.dumpSitesJSON(c, unifi.APIDevicePath, sites) return u.getSitesJSON(c, unifi.APIDevicePath, sites)
case "client", "clients", "c": case "client", "clients", "c":
return u.dumpSitesJSON(c, unifi.APIClientPath, sites) return u.getSitesJSON(c, unifi.APIClientPath, sites)
case "other", "o": case "other", "o":
return c.Unifi.GetJSON(filter.Path) return c.Unifi.GetJSON(filter.Path)
default: default:
@ -181,11 +181,14 @@ func (u *InputUnifi) RawMetrics(filter *poller.Filter) ([]byte, error) {
} }
} }
func (u *InputUnifi) dumpSitesJSON(c *Controller, path string, sites []*unifi.Site) ([]byte, error) { func (u *InputUnifi) getSitesJSON(c *Controller, path string, sites []*unifi.Site) ([]byte, error) {
allJSON := []byte{} allJSON := []byte{}
for _, s := range sites { for _, s := range sites {
body, err := c.Unifi.GetJSON(fmt.Sprintf(path, s.Name)) apiPath := fmt.Sprintf(path, s.Name)
u.LogDebugf("Returning Path '%s' for site: %s (%s):\n", apiPath, s.Desc, s.Name)
body, err := c.Unifi.GetJSON(apiPath)
if err != nil { if err != nil {
return allJSON, err return allJSON, err
} }