add logging
This commit is contained in:
@@ -25,7 +25,6 @@ RUN apk add --no-cache ca-certificates && \
|
|||||||
|
|
||||||
# Copy binary + schema file used at startup
|
# Copy binary + schema file used at startup
|
||||||
COPY --from=build /out/ingestd /app/ingestd
|
COPY --from=build /out/ingestd /app/ingestd
|
||||||
COPY internal/db/schema.sql /app/internal/db/schema.sql
|
|
||||||
|
|
||||||
USER appuser
|
USER appuser
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
log.SetOutput(os.Stdout)
|
||||||
|
|
||||||
var cfgPath string
|
var cfgPath string
|
||||||
flag.StringVar(&cfgPath, "config", "config.yaml", "path to config yaml")
|
flag.StringVar(&cfgPath, "config", "config.yaml", "path to config yaml")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
@@ -68,6 +70,8 @@ func main() {
|
|||||||
Topic: cfg.MQTT.Topic,
|
Topic: cfg.MQTT.Topic,
|
||||||
QoS: cfg.MQTT.QoS,
|
QoS: cfg.MQTT.QoS,
|
||||||
}, func(ctx context.Context, topic string, payload []byte) error {
|
}, 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)
|
p, raw, err := mqttingest.ParseWS90(payload)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("ws90 parse error topic=%s err=%v payload=%s", topic, err, string(payload))
|
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
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Printf("wunderground upload start station_id=%s", stationID)
|
||||||
|
|
||||||
up := providers.WUUpload{
|
up := providers.WUUpload{
|
||||||
StationID: stationID,
|
StationID: stationID,
|
||||||
StationKey: stationKey,
|
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) {
|
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)
|
res, err := p.Fetch(ctx.Done(), site, model)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("forecast fetch error provider=%s err=%v", p.Name(), err)
|
log.Printf("forecast fetch error provider=%s err=%v", p.Name(), err)
|
||||||
|
|||||||
Reference in New Issue
Block a user