Skip to content

Commit

Permalink
refactor: changed some of the error logs to debug from info mode
Browse files Browse the repository at this point in the history
Signed-off-by: preethi-satishcandra <[email protected]>
  • Loading branch information
presatish committed Sep 27, 2023
1 parent 02f8348 commit ede1d2d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions as-vending/functions/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,24 +440,24 @@ func (vendingState *VendingState) SendCommand(lc logger.LoggingClient, actionNam

switch actionName {
case http.MethodPut:
lc.Infof("executing %s action", actionName)
lc.Infof("Issuing SET command '%s' for device '%s'", commandName, deviceName)
lc.Debugf("executing %s action", actionName)
lc.Debugf("Issuing SET command '%s' for device '%s'", commandName, deviceName)

response, err := vendingState.CommandClient.IssueSetCommandByName(context.Background(), deviceName, commandName, settings)
if err != nil {
return fmt.Errorf("failed to issue '%s' set command to '%s' device: %s", commandName, deviceName, err.Error())
}

lc.Infof("response status: %d", response.StatusCode)
lc.Debugf("response status: %d", response.StatusCode)

case http.MethodGet:
lc.Infof("executing %s action", actionName)
lc.Infof("Issuing GET command '%s' for device '%s'", commandName, deviceName)
lc.Debugf("executing %s action", actionName)
lc.Debugf("Issuing GET command '%s' for device '%s'", commandName, deviceName)
response, err := vendingState.CommandClient.IssueGetCommandByName(context.Background(), deviceName, commandName, false, true)
if err != nil {
return fmt.Errorf("failed to issue '%s' get command to '%s' device: %s", commandName, deviceName, err.Error())
}
lc.Infof("response status: %d", response.StatusCode)
lc.Debugf("response status: %d", response.StatusCode)

default:
return errors.New("Invalid action requested: " + actionName)
Expand Down

0 comments on commit ede1d2d

Please sign in to comment.