<commit_before>import datetime
import logging

import sys
import traceback

import os
from wwsync.fitbit import auth, get_units, clear_food_logs, make_food_log, get_food_logs
from wwsync.weight_watchers import get_nutrition_info_for_day


def setup_logging():
    logging.basicConfig(level='INFO', format='%(asctime)s %(message)s')

    def log_exceptions(exctype, value, tb):
        """
        Make sure any uncaught exceptions are logged
        """
        logging.error("Uncaught Exception: {} - {}\n{}".format(exctype.__name__, value, ''.join(traceback.format_tb(tb))))
        sys.__excepthook__(exctype, value, tb)
    sys.excepthook = log_exceptions


def main():
    if len(sys.argv) > 1:
        date = datetime.datetime.strptime(sys.argv[1], '%Y-%m-%d')
    else:
        date = datetime.datetime.now()
    setup_logging()
    client_id = os.environ['WW_FB_ID']
    secret = os.environ['WW_FB_SECRET']
    nutritional_info_for_day = get_nutrition_info_for_day(
        os.environ['WW_USER'],
        os.environ['WW_PASSWD'],<commit_msg>Add log sayign what date we are formatting<commit_after>import datetime
import logging

import sys
import traceback

import os
from wwsync.fitbit import auth, get_units, clear_food_logs, make_food_log, get_food_logs
from wwsync.weight_watchers import get_nutrition_info_for_day


def setup_logging():
    logging.basicConfig(level='INFO', format='%(asctime)s %(message)s')

    def log_exceptions(exctype, value, tb):
        """
        Make sure any uncaught exceptions are logged
        """
        logging.error("Uncaught Exception: {} - {}\n{}".format(exctype.__name__, value, ''.join(traceback.format_tb(tb))))
        sys.__excepthook__(exctype, value, tb)
    sys.excepthook = log_exceptions


def main():
    if len(sys.argv) > 1:
        date = datetime.datetime.strptime(sys.argv[1], '%Y-%m-%d')
    else:
        date = datetime.datetime.now()
    setup_logging()
    logging.info("Updating foods for {}".format("{:%Y-%m-%d}".format(date)))
    client_id = os.environ['WW_FB_ID']
    secret = os.environ['WW_FB_SECRET']
    nutritional_info_for_day = get_nutrition_info_for_day(
        os.environ['WW_USER'],
        os.environ['WW_PASSWD'],
{'fraction_non_alphanumeric': 0.13021778584392016, 'fraction_numerical': 0.0018148820326678765, 'mean_word_length': 3.8461538461538463, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5954383', 'n_tokens_mistral': 749, 'n_tokens_neox': 733, 'n_words': 146}