Ocpp: reduce logging

This commit is contained in:
andig 2023-06-14 19:19:43 +02:00
parent 58b2e0ece2
commit aaa48022e8
2 changed files with 36 additions and 24 deletions

View file

@ -102,27 +102,3 @@ func (cs *CS) ChargePointDisconnected(chargePoint ocpp16.ChargePointConnection)
}
}
}
func (cs *CS) Debug(args ...interface{}) {
cs.log.TRACE.Println(args...)
}
func (cs *CS) Debugf(fmt string, args ...interface{}) {
cs.log.TRACE.Printf(fmt, args...)
}
func (cs *CS) Info(args ...interface{}) {
cs.log.TRACE.Println(args...)
}
func (cs *CS) Infof(fmt string, args ...interface{}) {
cs.log.TRACE.Printf(fmt, args...)
}
func (cs *CS) Error(args ...interface{}) {
cs.log.TRACE.Println(args...)
}
func (cs *CS) Errorf(fmt string, args ...interface{}) {
cs.log.TRACE.Printf(fmt, args...)
}

36
charger/ocpp/cs_log.go Normal file
View file

@ -0,0 +1,36 @@
package ocpp
import (
"fmt"
"strings"
)
func (cs *CS) print(s string) {
if strings.Contains(s, "JSON message") {
cs.log.TRACE.Println(s)
}
}
func (cs *CS) Debug(args ...interface{}) {
cs.print(fmt.Sprintln(args...))
}
func (cs *CS) Debugf(f string, args ...interface{}) {
cs.print(fmt.Sprintf(f, args...))
}
func (cs *CS) Info(args ...interface{}) {
cs.print(fmt.Sprintln(args...))
}
func (cs *CS) Infof(f string, args ...interface{}) {
cs.print(fmt.Sprintf(f, args...))
}
func (cs *CS) Error(args ...interface{}) {
cs.print(fmt.Sprintln(args...))
}
func (cs *CS) Errorf(f string, args ...interface{}) {
cs.print(fmt.Sprintf(f, args...))
}