<commit_before>from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy

import os
from flask.ext.login import LoginManager
from flask.ext.openid import OpenID
from config import basedir
import logging


def setup_logger(logger_instance):

    if logger.handlers:  # prevents the loading of duplicate handlers/log output
        return
    ch = logging.StreamHandler()
    formatter = logging.Formatter('(%(asctime)s: %(name)s: %(levelname)s): %(message)s')
    ch.setFormatter(formatter)
    logger_instance.addHandler(ch)
    hdlr = logging.FileHandler('./insolvency_logger.log')
    hdlr.setFormatter(formatter)
    logger.addHandler(hdlr)


logger = logging.getLogger(__name__)
setup_logger(logger)
logger.setLevel(logging.DEBUG)
logger.info('completed logger config. beginning to load application.')

app = Flask(__name__)
app.config.from_object('config')

db = SQLAlchemy(app)


lm = LoginManager()
lm.init_app(app)
oid = OpenID(app, os.path.join(basedir, 'tmp'))<commit_msg>logging still seems no good.<commit_after>from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy

import os
from flask.ext.login import LoginManager
from flask.ext.openid import OpenID
from config import basedir
import logging


def setup_logger(logger_instance):

    if logger.handlers:  # prevents the loading of duplicate handlers/log output
        return

    formatter = logging.Formatter('(%(asctime)s: %(name)s: %(levelname)s): %(message)s')

    if app.debug:
        ch = logging.StreamHandler()
        ch.setFormatter(formatter)
        logger_instance.addHandler(ch)
    else:
        ch = logging.FileHandler('./insolvency_logger.log')
        ch.setLevel(logging.INFO)
        ch.setFormatter(formatter)
        logger.addHandler(ch)


logger = logging.getLogger(__name__)
setup_logger(logger)
logger.setLevel(logging.DEBUG)
logger.info('completed logger config. beginning to load application.')

app = Flask(__name__)
app.config.from_object('config')

db = SQLAlchemy(app)


lm = LoginManager()
lm.init_app(app)
oid = OpenID(app, os.path.join(basedir, 'tmp'))
{'fraction_non_alphanumeric': 0.10956271023546373, 'fraction_numerical': 0.0, 'mean_word_length': 4.552, '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': '1250971', 'n_tokens_mistral': 668, 'n_tokens_neox': 636, 'n_words': 151}