to internal logger for levels, all encompassing path

This commit is contained in:
bel
2022-01-17 18:16:23 -07:00
parent e660f2ef9f
commit 73ccc22fd5
9 changed files with 179 additions and 55 deletions

View File

@@ -8,7 +8,7 @@ import (
"io"
"io/ioutil"
"local/truckstop/config"
"log"
"local/truckstop/logtr"
"net/http"
"time"
)
@@ -120,7 +120,7 @@ func (ntg NTGVision) searchJob(id int64) (io.ReadCloser, error) {
}
defer resp.Body.Close()
b, _ := ioutil.ReadAll(resp.Body)
log.Printf("fetch ntg job info %+v: %d: %s", request, resp.StatusCode, b)
logtr.Debugf("fetch ntg job info %+v: %d: %s", request, resp.StatusCode, b)
if resp.StatusCode > 400 && resp.StatusCode < 500 && resp.StatusCode != 404 && resp.StatusCode != 410 {
return nil, ErrNoAuth
}
@@ -149,7 +149,7 @@ func (ntgJob *ntgVisionJob) Job() Job {
secrets: func() interface{} {
jobInfo, err := ntgJob.JobInfo()
if err != nil {
log.Printf("failed to get jobinfo: %v", err)
logtr.Errorf("failed to get jobinfo: %v", err)
return nil
}
return jobInfo.String()
@@ -199,7 +199,7 @@ func (ntg NTGVision) Search(states []config.State) ([]Job, error) {
return nil, err
}
log.Printf("ntg search for %+v: %s", states, b)
logtr.Debugf("ntg search for %+v: %s", states, b)
var ntgjobs []ntgVisionJob
err = json.Unmarshal(b, &ntgjobs)
@@ -243,7 +243,7 @@ func (ntg NTGVision) search(states []config.State) (io.ReadCloser, error) {
}
func (ntg NTGVision) refreshAuth() error {
log.Printf("refreshing ntg auth...")
logtr.Infof("refreshing ntg auth...")
b, _ := json.Marshal(map[string]string{
"username": config.Get().Brokers.NTG.Username,
"password": config.Get().Brokers.NTG.Password,