<commit_before>from device import ProgramRunner
import logging
from logging.handlers import RotatingFileHandler
from device import heater
from interface import APIInterface
from device import thermometer
import Adafruit_MAX31855.MAX31855 as MAX31855
import RPi.GPIO as GPIO

# Disable the temperature probe logger because it produces annoying and useless messages
maxlog = logging.getLogger('Adafruit_MAX31855.MAX31855')
maxlog.disabled = True

# Set up a logger for application notifications and errors
log = logging.getLogger("heater")
handler = RotatingFileHandler('/var/log/piwarmer/heater.log', maxBytes=1024*1024*100, backupCount=5)
formatter = logging.Formatter('%(asctime)s\t%(name)s\t%(levelname)s\t\t%(message)s')
handler.setFormatter(formatter)
log.addHandler(handler)
log.setLevel(logging.DEBUG)


if __name__ == "__main__":
    api_interface = APIInterface()
    thermometer = thermometer.Thermometer(MAX31855.MAX31855(24, 23, 18))
    heater = heater.Heater(GPIO)
    with ProgramRunner(api_interface, thermometer, heater) as program:
        program.run()<commit_msg>made log rotation happen much more frequently so we won't lose as much data<commit_after>from device import ProgramRunner
import logging
from logging.handlers import RotatingFileHandler
from device import heater
from interface import APIInterface
from device import thermometer
import Adafruit_MAX31855.MAX31855 as MAX31855
import RPi.GPIO as GPIO

# Disable the temperature probe logger because it produces annoying and useless messages
maxlog = logging.getLogger('Adafruit_MAX31855.MAX31855')
maxlog.disabled = True

# Set up a logger for application notifications and errors
log = logging.getLogger("heater")
handler = RotatingFileHandler('/var/log/piwarmer/heater.log', maxBytes=1024, backupCount=5000)
formatter = logging.Formatter('%(asctime)s\t%(name)s\t%(levelname)s\t\t%(message)s')
handler.setFormatter(formatter)
log.addHandler(handler)
log.setLevel(logging.DEBUG)


if __name__ == "__main__":
    api_interface = APIInterface()
    thermometer = thermometer.Thermometer(MAX31855.MAX31855(24, 23, 18))
    heater = heater.Heater(GPIO)
    with ProgramRunner(api_interface, thermometer, heater) as program:
        program.run()
{'fraction_non_alphanumeric': 0.08963963963963964, 'fraction_numerical': 0.04594594594594595, 'mean_word_length': 6.211038961038961, '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': '5140268', 'n_tokens_mistral': 734, 'n_tokens_neox': 638, 'n_words': 180}