import time
import ltr559
+import logging
-print("""light.py - Print readings from the LTR559 Light & Proximity sensor.
+logging.basicConfig(
+ format='%(asctime)s.%(msecs)03d %(levelname)-8s %(message)s',
+ level=logging.INFO,
+ datefmt='%Y-%m-%d %H:%M:%S')
+
+logging.info("""light.py - Print readings from the LTR559 Light & Proximity sensor.
Press Ctrl+C to exit!
while True:
lux = ltr559.get_lux()
prox = ltr559.get_proximity()
- print("""Light: {:05.02f} Lux
+ logging.info("""Light: {:05.02f} Lux
Proximity: {:05.02f}
""".format(lux, prox))
time.sleep(1.0)