X-Git-Url: https://zdv2.bktei.com/gitweb/EVA-2020-02-2.git/blobdiff_plain/0cf10e5bb8354458b6eac7d04d4aa6235bedcf73..2fe226f8a1755e1cf487c972b56b9166b4f2ff4b:/examples/gas.py?ds=inline diff --git a/examples/gas.py b/examples/gas.py index 6da2a65..2f84944 100755 --- a/examples/gas.py +++ b/examples/gas.py @@ -1,19 +1,24 @@ #!/usr/bin/env python import time -from envirophatplus import gas +from enviroplus import gas +import logging +logging.basicConfig( + format='%(asctime)s.%(msecs)03d %(levelname)-8s %(message)s', + level=logging.INFO, + datefmt='%Y-%m-%d %H:%M:%S') -print("""gas.py - Print readings from the MICS6812 Gas sensor. +logging.info("""gas.py - Print readings from the MICS6814 Gas sensor. Press Ctrl+C to exit! - + """) try: while True: readings = gas.read_all() - print(readings) + logging.info(readings) time.sleep(1.0) except KeyboardInterrupt: pass