<commit_before>#!/usr/bin/env python
# coding=utf-8
"""
This is a simple example of using Python's logging module to log to a file.

Expected output (to file 'example.log' in same directory as script is run):
    DEBUG:root:This message should go to the log file
    INFO:root:So should this
    WARNING:root:And this, too

This example also shows how you can set the logging level which acts as the threshold for tracking.
In this case, because we set the threshold to DEBUG, all of the messages were printed.
"""
import logging

LOG_FILE = 'example.log'

LOG_LEVEL = logging.DEBUG

APPEND = False
if APPEND:
    mode = 'a'
else:
    mode = 'w'

# Note the "8s" right-justifies the levelname in an 8-char wide field.  For left justification, use "-8s" instead.
LOG_FORMAT = '%(asctime)s - %(levelname)8s: %(message)s'

logging.basicConfig(filename=LOG_FILE, filemode=mode, format=LOG_FORMAT, level=LOG_LEVEL)
logging.debug('This message should go to the log file')
logging.info('So should this')
logging.warning('{} before you {}'.format('Look', 'leap!'))
<commit_msg>Updated logging format to print seconds part of time using a period instead of a comma.<commit_after>#!/usr/bin/env python
# coding=utf-8
"""
This is a simple example of using Python's logging module to log to a file.

Expected output (to file 'example.log' in same directory as script is run):
    DEBUG:root:This message should go to the log file
    INFO:root:So should this
    WARNING:root:And this, too

This example also shows how you can set the logging level which acts as the threshold for tracking.
In this case, because we set the threshold to DEBUG, all of the messages were printed.
"""
import logging

LOG_FILE = 'example.log'

LOG_LEVEL = logging.DEBUG

APPEND = False
if APPEND:
    mode = 'a'
else:
    mode = 'w'

# Note the "8s" right-justifies the levelname in an 8-char wide field.  For left justification, use "-8s" instead.
LOG_FORMAT = '%(asctime)s.%(msecs)03d - %(levelname)8s: %(message)s'

# The default time format uses a comma to separate subseconds.  We fix that and print with a "." with ms resolution.
DATE_FORMAT = '%Y-%m-%d,%H:%M:%S'

logging.basicConfig(filename=LOG_FILE, filemode=mode, level=LOG_LEVEL, format=LOG_FORMAT, datefmt=DATE_FORMAT)
logging.debug('This message should go to the log file')
logging.info('So should this')
logging.warning('{} before you {}'.format('Look', 'leap!'))

{'fraction_non_alphanumeric': 0.10638297872340426, 'fraction_numerical': 0.0050062578222778474, 'mean_word_length': 4.462414578587699, 'pattern_counts': {'":': 0, '<': 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': '5429470', 'n_tokens_mistral': 747, 'n_tokens_neox': 728, 'n_words': 306}