Skip to content

Commit

Permalink
Add debug log on send/receive commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Fizzadar committed Jan 3, 2024
1 parent 6b4b803 commit 63b3b31
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,17 @@ func (p *provider) ExecuteCommand(command string) (json.RawMessage, error) {
}

// Send over our command and listen for the result
p.log.Debug().
Int("req_id", p.reqID).
Str("command", command).
Msg("Send request")
go p.ws.WriteMessage(websocket.TextMessage, buf)

select {
case result := <-p.resultsCh:
p.log.Debug().
Int("req_id", p.reqID).
Msg("Received response")
return result, nil
case <-time.After(providerRequestTimeout):
// If the request times out shoot the underlying websocket connection to force a reconnect
Expand Down

0 comments on commit 63b3b31

Please sign in to comment.