Implemented logging class as logger

This commit is contained in:
Maximilian Giller 2021-10-07 12:33:00 +02:00
parent edfbe4e6c3
commit bb71209da5

View file

@ -1,5 +1,6 @@
from sensor.tofsensor import ToFSensor, Directions
from datetime import datetime
import logging
COUNTING_CB = "counting"
@ -35,9 +36,7 @@ class PeopleCounter ():
while self.keepRunning:
# Switch to other direction
direction: Directions = Directions.other(direction)
print("-" * 20)
print("Direction:",direction)
print("At time",datetime.now())
logging.debug(f'Direction [{direction}] at {datetime.now()}')
self.sensor.setDirection(direction)
@ -48,7 +47,7 @@ class PeopleCounter ():
if changed:
countChange: int = self.getCountChange(self.directionState)
self.handleCallbacks(countChange)
self.sensor.close()
def getCountChange(self, directionState) -> int: