Skip to content

Commit

Permalink
fix(agent,tracker): adjust log levels for tracker-related messages
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuar committed Jul 10, 2023
1 parent da1be00 commit 6938a35
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
11 changes: 5 additions & 6 deletions internal/agent/tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@ import (
)

func (agent *Agent) runSensorTracker(ctx context.Context) {
log.Debug().Caller().Msg("Starting sensor tracker.")
registryPath, err := agent.extraStoragePath("sensorRegistry")
if err != nil {
log.Debug().Err(err).
Msg("Unable to store registry on disk, trying in-memory store.")
log.Warn().Err(err).
Msg("Unable to store registry on disk, will attempt in-memory store.")
}

sensorTracker = tracker.NewSensorTracker(ctx, registryPath.Path())
if sensorTracker == nil {
log.Debug().Msg("Unable to create a sensor tracker.")
log.Error().Msg("Unable to create a sensor tracker.")
return
}
updateCh := make(chan interface{})
Expand All @@ -39,11 +38,11 @@ func (agent *Agent) runSensorTracker(ctx context.Context) {
case location.Update:
go location.SendUpdate(ctx, data)
default:
log.Debug().Caller().
log.Warn().
Msgf("Got unexpected status update %v", data)
}
case <-ctx.Done():
log.Debug().Caller().
log.Debug().
Msg("Stopping sensor tracking.")
return
}
Expand Down
6 changes: 3 additions & 3 deletions internal/tracker/tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ type SensorTracker struct {
func NewSensorTracker(ctx context.Context, path string) *SensorTracker {
db, err := NewNutsDB(ctx, path)
if err != nil {
log.Debug().Err(err).
Msg("Could not open database.")
log.Error().Err(err).
Msg("Could not open registry database.")
return nil
}
return &SensorTracker{
Expand Down Expand Up @@ -66,7 +66,7 @@ func (tracker *SensorTracker) StartWorkers(ctx context.Context, updateCh chan in
// Run all the defined sensor update functions.
deviceAPI, err := device.FetchAPIFromContext(ctx)
if err != nil {
log.Debug().Caller().Err(err).
log.Error().Err(err).
Msg("Could not fetch sensor workers.")
return
}
Expand Down

0 comments on commit 6938a35

Please sign in to comment.