Ocpp: reduce trace logs

This commit is contained in:
andig 2024-11-09 13:04:18 +01:00
parent fe2978d724
commit ba75820a42

View file

@ -2,18 +2,33 @@ package ocpp
import (
"fmt"
"strings"
)
func (cs *CS) print(s string) {
// var ok bool
// if s, ok = strings.CutPrefix(s, "sent JSON message to"); ok {
// s = "send" + s
// } else if s, ok = strings.CutPrefix(s, "received JSON message from"); ok {
// s = "recv" + s
// }
// if ok {
cs.log.TRACE.Println(s)
// for _, p := range []string{
// "completed request",
// "dispatched request",
// "enqueued CALL",
// "handling incoming",
// "sent CALL",
// "started timeout",
// "timeout canceled",
// } {
// if strings.HasPrefix(s, p) {
// return
// }
// }
var ok bool
if s, ok = strings.CutPrefix(s, "sent JSON message to"); ok {
s = "send" + s
} else if s, ok = strings.CutPrefix(s, "received JSON message from"); ok {
s = "recv" + s
}
if ok {
cs.log.TRACE.Println(s)
}
}
func (cs *CS) Debug(args ...interface{}) {