<commit_before>from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import LoginManager
from flask.ext.migrate import Migrate
from flask_bootstrap import Bootstrap, WebCDN
from flask.ext.misaka import Misaka
from flask.ext.moment import Moment
from flask.ext.pagedown import PageDown
from flask.ext.restful import Api
from flask.ext.httpauth import HTTPBasicAuth
from flask_mail import Mail
from config import config
import os


app = Flask(__name__)

# config handling
if os.getenv('FLASK_CONFIG'):
    flask_config = os.getenv('FLASK_CONFIG')
else:
    flask_config = 'default'

app.config.from_object(config[flask_config])

# Bootstrap
Bootstrap(app)
app.extensions['bootstrap']['cdns']['jquery'] = WebCDN(
    '//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/')

# Misaka Markdown
Misaka(app)

# Moment.js
moment = Moment(app)
<commit_msg>added logging in production mode<commit_after>from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import LoginManager
from flask.ext.migrate import Migrate
from flask_bootstrap import Bootstrap, WebCDN
from flask.ext.misaka import Misaka
from flask.ext.moment import Moment
from flask.ext.pagedown import PageDown
from flask.ext.restful import Api
from flask.ext.httpauth import HTTPBasicAuth
from flask_mail import Mail
from config import config
import os


app = Flask(__name__)

# config handling
if os.getenv('FLASK_CONFIG'):
    flask_config = os.getenv('FLASK_CONFIG')
else:
    flask_config = 'default'

app.config.from_object(config[flask_config])

# logging
if not app.debug and not app.testing:
    import logging
    from logging.handlers import RotatingFileHandler

    file_handler = RotatingFileHandler('/var/log/genesis/genesis.log')
    file_handler.setLevel(logging.DEBUG)

    file_handler.setFormatter(logging.Formatter(
        '%(asctime)s %(levelname)s: %(message)s '
        '[in %(pathname)s:%(lineno)d]'))

    app.logger.addHandler(file_handler)

# Bootstrap
Bootstrap(app)
app.extensions['bootstrap']['cdns']['jquery'] = WebCDN(
    '//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/')

# Misaka Markdown
Misaka(app)

# Moment.js
moment = Moment(app)

{'fraction_non_alphanumeric': 0.10232983097304706, 'fraction_numerical': 0.002740977615349475, 'mean_word_length': 5.100278551532034, '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': '568960', 'n_tokens_mistral': 750, 'n_tokens_neox': 701, 'n_words': 175}