Skip to content

Commit

Permalink
fix(device): adjust log levels for external_ip sensor
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuar committed Jul 10, 2023
1 parent 5b24fe2 commit e01ab42
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions internal/device/external_ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,18 @@ func lookupExternalIPs(ctx context.Context) []*address {
ip6 := &address{}

for host, addr := range ipLookupHosts {
log.Debug().Caller().
log.Trace().Caller().
Msgf("Trying to find external IP addresses with %s", host)
for ver, url := range addr {
var s string
err := requests.
URL(url).
ToString(&s).
Fetch(ctx)
log.Debug().Caller().
log.Trace().Caller().
Msgf("Fetching %s address from %s", ver, url)
if err != nil {
log.Debug().Caller().Err(err).
log.Warn().Err(err).
Msgf("Unable to retrieve external %s address", ver)
} else {
s = strings.TrimSpace(s)
Expand All @@ -127,7 +127,7 @@ func lookupExternalIPs(ctx context.Context) []*address {
}
// At this point, we've gone through all IP checkers and not found an
// external address
log.Debug().Caller().Msg("Couldn't retrieve any external IP address.")
log.Warn().Msg("Couldn't retrieve *any* external IP address.")
return nil
}

Expand Down Expand Up @@ -155,9 +155,9 @@ func ExternalIPUpdater(ctx context.Context, status chan interface{}) {
for {
select {
case <-ctx.Done():
return
return
case <-ticker.C:
log.Debug().Caller().Msg("Checking for external IP update...")
log.Trace().Caller().Msg("Checking for external IP update...")
updateExternalIP()
}
}
Expand Down

0 comments on commit e01ab42

Please sign in to comment.