X-Git-Url: https://zdv2.bktei.com/gitweb/EVA-2020-02-2.git/blobdiff_plain/0cf10e5bb8354458b6eac7d04d4aa6235bedcf73..476a391afd0fdced2c3e0294dd3efded0e57a7b7:/examples/light.py diff --git a/examples/light.py b/examples/light.py index aa895f1..3442fb4 100755 --- a/examples/light.py +++ b/examples/light.py @@ -2,19 +2,24 @@ import time import ltr559 +import logging +logging.basicConfig( + format='%(asctime)s.%(msecs)03d %(levelname)-8s %(message)s', + level=logging.INFO, + datefmt='%Y-%m-%d %H:%M:%S') -print("""light.py - Print readings from the LTR559 Light & Proximity sensor. +logging.info("""light.py - Print readings from the LTR559 Light & Proximity sensor. Press Ctrl+C to exit! - + """) 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)