Skip to content

Commit

Permalink
chore: remove duplicate logging
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Jul 22, 2024
1 parent c6a7d82 commit 5d540f6
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions charger/ocpp/cs_core.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,19 @@ import (

func (cs *CS) TriggerResetRequest(id string, resetType core.ResetType) {
if err := cs.Reset(id, func(request *core.ResetConfirmation, err error) {
log := cs.log.TRACE
if err == nil && request != nil && request.Status != core.ResetStatusAccepted {
log = cs.log.ERROR
cs.log.ERROR.Printf("TriggerReset for %s: %+v", id, request.Status)
}

var status core.ResetStatus
if request != nil {
status = request.Status
}

log.Printf("TriggerReset for %s: %+v", id, status)
}, resetType); err != nil {
cs.log.ERROR.Printf("send TriggerReset for %s failed: %v", id, err)
}
}

func (cs *CS) TriggerMessageRequest(id string, requestedMessage remotetrigger.MessageTrigger, props ...func(request *remotetrigger.TriggerMessageRequest)) {
if err := cs.TriggerMessage(id, func(request *remotetrigger.TriggerMessageConfirmation, err error) {
log := cs.log.TRACE
if err == nil && request != nil && request.Status != remotetrigger.TriggerMessageStatusAccepted {
log = cs.log.ERROR
cs.log.ERROR.Printf("TriggerMessage %s for %s: %+v", requestedMessage, id, request.Status)
}

var status remotetrigger.TriggerMessageStatus
if request != nil {
status = request.Status
}

log.Printf("TriggerMessage %s for %s: %+v", requestedMessage, id, status)
}, requestedMessage, props...); err != nil {
cs.log.ERROR.Printf("send TriggerMessage %s for %s failed: %v", requestedMessage, id, err)
}
Expand Down

0 comments on commit 5d540f6

Please sign in to comment.