diff --git a/examples/influxdb/main.go b/examples/influxdb/main.go index a06a42c..065a5a2 100644 --- a/examples/influxdb/main.go +++ b/examples/influxdb/main.go @@ -190,7 +190,6 @@ func (c *Calculation) currentDecrecment(ts string, tz string) { } res, err := client.Do(req) - fmt.Println(res) if err != nil { fmt.Println(err) return @@ -241,7 +240,8 @@ func main() { ) d.OpenDataMeasurementAllByStation(p) - fmt.Println(d.OpenData) + log.Info("Gathered data") + log.Info(d.OpenData) str := fmt.Sprintf("%s-%s-%sT%s:%s:%s", p.Any, p.Mes, p.Dia, p.Hour, p.Minute, p.Seconds) tt, err := time.Parse(layout, str) @@ -258,6 +258,7 @@ func main() { Fields, tt) // write point asynchronously writeAPI.WritePoint(context.Background(), p) + } // always close client at the end defer c.Close() diff --git a/opendata.go b/opendata.go index 8e44fea..10c0ae3 100644 --- a/opendata.go +++ b/opendata.go @@ -35,7 +35,7 @@ func (s *OpenDataMeasurements) OpenDataMeasurementAllByStation(p *Parameters) er req, err := http.NewRequest("GET", fmt.Sprintf( openDataURL, fmt.Sprintf("?data_lectura=%s-%s-%sT%s:%s:%s", p.Any, p.Mes, p.Dia, p.Hour, p.Minute, p.Seconds)), nil) // 2021-12-05T04:30:00.000 - fmt.Println(req) + if err != nil { return err }