X-Git-Url: https://zdv2.bktei.com/gitweb/EVA-2020-02-2.git/blobdiff_plain/69294f3c5533bbc58457624ee3e1da1a7b3201b0..10b73e181c132294ea7ab9ee8b0ddc1fb2670781:/examples/light.py?ds=sidebyside diff --git a/examples/light.py b/examples/light.py index 216477a..3442fb4 100755 --- a/examples/light.py +++ b/examples/light.py @@ -2,8 +2,14 @@ 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! @@ -13,7 +19,7 @@ try: 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)