comparison pkg/imports/gm.go @ 5490:5f47eeea988d logging

Use own logging package.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 20 Sep 2021 17:45:39 +0200
parents 56c589f7435d
children 133dc5b3076a
comparison
equal deleted inserted replaced
5488:a726a92ea5c9 5490:5f47eeea988d
17 17
18 import ( 18 import (
19 "context" 19 "context"
20 "database/sql" 20 "database/sql"
21 "fmt" 21 "fmt"
22 "log"
23 "sort" 22 "sort"
24 "strings" 23 "strings"
25 "time" 24 "time"
26 25
26 "github.com/jackc/pgx/pgtype"
27
28 "gemma.intevation.de/gemma/pkg/log"
27 "gemma.intevation.de/gemma/pkg/models" 29 "gemma.intevation.de/gemma/pkg/models"
28 "gemma.intevation.de/gemma/pkg/pgxutils" 30 "gemma.intevation.de/gemma/pkg/pgxutils"
29 "gemma.intevation.de/gemma/pkg/soap/nts" 31 "gemma.intevation.de/gemma/pkg/soap/nts"
30 "github.com/jackc/pgx/pgtype"
31 ) 32 )
32 33
33 // GaugeMeasurement is an import job to import 34 // GaugeMeasurement is an import job to import
34 // gauges measurement data from a NtS SOAP service. 35 // gauges measurement data from a NtS SOAP service.
35 type GaugeMeasurement struct { 36 type GaugeMeasurement struct {
183 again: 184 again:
184 resp, err := client.Get_messages(req) 185 resp, err := client.Get_messages(req)
185 186
186 if err != nil { 187 if err != nil {
187 if t, ok := err.(interface{ Timeout() bool }); ok && t.Timeout() && tries < maxTries { 188 if t, ok := err.(interface{ Timeout() bool }); ok && t.Timeout() && tries < maxTries {
188 log.Println("warn: NtS SOAP request timed out. Trying again.") 189 log.Warnln("NtS SOAP request timed out. Trying again.")
189 tries++ 190 tries++
190 goto again 191 goto again
191 } 192 }
192 return nil, fmt.Errorf( 193 return nil, fmt.Errorf(
193 "Error requesting NtS service: %v", err) 194 "Error requesting NtS service: %v", err)