Add temporary session debugging

This commit is contained in:
andig 2022-11-28 10:22:51 +01:00
parent da35fad6d2
commit a2ae1e1074
2 changed files with 12 additions and 0 deletions

View file

@ -44,6 +44,9 @@ func (s *DB) Session(meter float64) *Session {
// Persist creates or updates a transaction in the database
func (s *DB) Persist(session interface{}) {
// TODO remove
s.log.DEBUG.Printf("persist: %+v", session)
if err := s.db.Save(session).Error; err != nil {
s.log.ERROR.Printf("persist: %v", err)
}

View file

@ -39,6 +39,9 @@ func (lp *LoadPoint) startSession() {
}
}
// TODO remove
lp.log.DEBUG.Println("session started")
lp.db.Persist(lp.session)
}
}
@ -51,6 +54,9 @@ func (lp *LoadPoint) stopSession() {
lp.session.Stop(lp.getChargedEnergy(), lp.chargeMeterTotal())
// TODO remove
lp.log.DEBUG.Println("session stopped")
lp.db.Persist(lp.session)
}
@ -66,6 +72,9 @@ func (lp *LoadPoint) updateSession(opts ...sessionOption) {
opt(lp.session)
}
// TODO remove
lp.log.DEBUG.Println("session updated")
lp.db.Persist(lp.session)
}