<commit_before>import sys

try:
    from . import ScorerConverter
    from PyQt5 import QtWidgets

    def main():
        app = QtWidgets.QApplication(sys.argv)
        sc = ScorerConverter(app)
        sc.show()
        app.exec_()

    if __name__ == "__main__":
        main()
except ImportError:
    def main():
        pass<commit_msg>GUI: log to console and a log file<commit_after>import logging.config
from pathlib import Path

log_file = Path.home() / '.scorer_to_usebio' / 'ScorerConverter.log'

def configure_logging():
    from PyQt5 import QtCore

    log_file.parent.mkdir(parents=True, exist_ok=True)

    logging.config.dictConfig({
        'version': 1,
        'disable_existing_loggers': False,

        'formatters': {
            'brief': {
                'format': '%(message)s',
            },
            'detailed': {
                'format': '%(asctime)s %(module)-17s %(lineno)-4d %(levelname)-8s %(message)s',
            },
        },

        'handlers': {
            'console': {
                'level':'DEBUG',
                'formatter': 'brief',
                'class': 'logging.StreamHandler',
            },

            'file': {
                'level':'DEBUG',
                'formatter': 'detailed',
                'class': 'logging.handlers.RotatingFileHandler',
                'filename': str(log_file),
                'maxBytes': 1024 * 1024,
                'backupCount': 1,
            },
        },

        'root': {
            'handlers': ['console', 'file'],
            'level': 'DEBUG',
            'propagate': True
        }
    })

    logging.debug('Logging to: %s', log_file)

try:
    import sys
    from . import ScorerConverter
    from PyQt5 import QtWidgets

    def main():
        configure_logging()
        app = QtWidgets.QApplication(sys.argv)
        sc = ScorerConverter(app)
        sc.show()
        app.exec_()
except ImportError:
    def main():
        pass

if __name__ == "__main__":
    main()
{'fraction_non_alphanumeric': 0.13212304589006554, 'fraction_numerical': 0.008572869389813415, 'mean_word_length': 1.7252747252747254, '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': '6695958', 'n_tokens_mistral': 612, 'n_tokens_neox': 578, 'n_words': 127}