<commit_before>import serial
from picloud_client import PiCloud


SERIAL_PORT = '/dev/ttyAMA0'
SERIAL_RATE = 9600
PICLOUD_EVENT = 'home:thpl'


def main():
    picloud = PiCloud(client_name='THPL-Data-Reporter')
    ser = serial.Serial(SERIAL_PORT, SERIAL_RATE)
    while True:
        sensor_json = ser.readline()
        picloud.publish(event=PICLOUD_EVENT, data=sensor_json)


if __name__ == "__main__":
    main()<commit_msg>Let's add some logging<commit_after>import logging
import serial
from picloud_client import PiCloud


SERIAL_PORT = '/dev/ttyAMA0'
SERIAL_RATE = 9600
PICLOUD_EVENT = 'home:thpl'


logging.basicConfig(
    level=logging.DEBUG,
    format='%(asctime)s %(levelname)s %(message)s',
    filename='/tmp/thpl-data-reporter.log',
    filemode='w')


def main():
    picloud = PiCloud(client_name='THPL-Data-Reporter')
    ser = serial.Serial(SERIAL_PORT, SERIAL_RATE)
    while True:
        try:
            sensor_json = ser.readline()
            picloud.publish(event=PICLOUD_EVENT, data=sensor_json)
        except Exception as e:
            logging.exception(e)
            raise e


if __name__ == "__main__":
    main()
{'fraction_non_alphanumeric': 0.11401218450826806, 'fraction_numerical': 0.008703220191470844, 'mean_word_length': 3.5098039215686274, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5658515', 'n_tokens_mistral': 417, 'n_tokens_neox': 405, 'n_words': 77}