import time
from enviroplus import gas
+import logging
-print("""adc.py - Print readings from the MICS6814 Gas sensor.
+logging.basicConfig(
+ format='%(asctime)s.%(msecs)03d %(levelname)-8s %(message)s',
+ level=logging.INFO,
+ datefmt='%Y-%m-%d %H:%M:%S')
+
+logging.info("""adc.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