X-Git-Url: https://zdv2.bktei.com/gitweb/EVA-2020-02-2.git/blobdiff_plain/8ab4cd2dbb0d51048f01e92a712e61d5da4fa120..be4506a78edb35b7bc4514949833cb86459e24c3:/examples/gas.py?ds=inline diff --git a/examples/gas.py b/examples/gas.py index 8717922..2f84944 100755 --- a/examples/gas.py +++ b/examples/gas.py @@ -2,9 +2,14 @@ import time 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! @@ -13,7 +18,7 @@ Press Ctrl+C to exit! try: while True: readings = gas.read_all() - print(readings) + logging.info(readings) time.sleep(1.0) except KeyboardInterrupt: pass