add logging
This commit is contained in:
@@ -16,6 +16,8 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
log.SetOutput(os.Stdout)
|
||||
|
||||
var cfgPath string
|
||||
flag.StringVar(&cfgPath, "config", "config.yaml", "path to config yaml")
|
||||
flag.Parse()
|
||||
@@ -68,6 +70,8 @@ func main() {
|
||||
Topic: cfg.MQTT.Topic,
|
||||
QoS: cfg.MQTT.QoS,
|
||||
}, func(ctx context.Context, topic string, payload []byte) error {
|
||||
log.Printf("mqtt message topic=%s bytes=%d payload=%s", topic, len(payload), string(payload))
|
||||
|
||||
p, raw, err := mqttingest.ParseWS90(payload)
|
||||
if err != nil {
|
||||
log.Printf("ws90 parse error topic=%s err=%v payload=%s", topic, err, string(payload))
|
||||
@@ -149,6 +153,8 @@ func runWundergroundUploader(ctx context.Context, latest *mqttingest.Latest, sta
|
||||
continue
|
||||
}
|
||||
|
||||
log.Printf("wunderground upload start station_id=%s", stationID)
|
||||
|
||||
up := providers.WUUpload{
|
||||
StationID: stationID,
|
||||
StationKey: stationKey,
|
||||
@@ -174,6 +180,8 @@ func runWundergroundUploader(ctx context.Context, latest *mqttingest.Latest, sta
|
||||
}
|
||||
|
||||
func pollOnce(ctx context.Context, d *db.DB, p providers.Provider, site providers.Site, model string) {
|
||||
log.Printf("forecast fetch start provider=%s model=%s site=%s", p.Name(), model, site.Name)
|
||||
|
||||
res, err := p.Fetch(ctx.Done(), site, model)
|
||||
if err != nil {
|
||||
log.Printf("forecast fetch error provider=%s err=%v", p.Name(), err)
|
||||
|
||||
Reference in New Issue
Block a user