<commit_before>import os

from flask import Flask
from flaskext.mongoengine import MongoEngine
from flaskext.cache import Cache
from flaskext.celery import Celery
import mongoengine
import logging

__version__ = "1.3.3"

app = Flask(__name__)

LEVELS = {'debug': logging.DEBUG,
          'info': logging.INFO,
          'warning': logging.WARNING,
          'error': logging.ERROR,
          'critical': logging.CRITICAL}

class PortAwareMongoEngine(MongoEngine):
    def init_app(self, app):
        db = app.config['MONGODB_DB']
        username = app.config.get('MONGODB_USERNAME', None)
        password = app.config.get('MONGODB_PASSWORD', None)
        port = app.config.get('MONGODB_PORT', 27017)

        # more settings e.g. port etc needed

        self.connection = mongoengine.connect(
            db=db, username=username, password=password, port=port)

app.config.from_object('kardboard.default_settings')
if os.getenv('KARDBOARD_SETTINGS', None):
    app.config.from_envvar('KARDBOARD_SETTINGS')

if app.config.get('LOG_FILE'):
    log_file = app.config['LOG_FILE']
    log_file = os.path.abspath(os.path.expanduser(log_file))
    new_handler = logging.handlers.RotatingFileHandler(
        log_file, maxBytes=1000, backupCount=3)
    if app.config.get('LOG_LEVEL'):
        new_level = app.config['LOG_LEVEL']
        new_level = LEVELS.get(new_level, logging.error)
        new_handler.setLevel(new_level)<commit_msg>Upped rotating log size<commit_after>import os

from flask import Flask
from flaskext.mongoengine import MongoEngine
from flaskext.cache import Cache
from flaskext.celery import Celery
import mongoengine
import logging

__version__ = "1.3.3"

app = Flask(__name__)

LEVELS = {'debug': logging.DEBUG,
          'info': logging.INFO,
          'warning': logging.WARNING,
          'error': logging.ERROR,
          'critical': logging.CRITICAL}

class PortAwareMongoEngine(MongoEngine):
    def init_app(self, app):
        db = app.config['MONGODB_DB']
        username = app.config.get('MONGODB_USERNAME', None)
        password = app.config.get('MONGODB_PASSWORD', None)
        port = app.config.get('MONGODB_PORT', 27017)

        # more settings e.g. port etc needed

        self.connection = mongoengine.connect(
            db=db, username=username, password=password, port=port)

app.config.from_object('kardboard.default_settings')
if os.getenv('KARDBOARD_SETTINGS', None):
    app.config.from_envvar('KARDBOARD_SETTINGS')

if app.config.get('LOG_FILE'):
    log_file = app.config['LOG_FILE']
    log_file = os.path.abspath(os.path.expanduser(log_file))
    new_handler = logging.handlers.RotatingFileHandler(
        log_file, maxBytes=100000, backupCount=3)
    if app.config.get('LOG_LEVEL'):
        new_level = app.config['LOG_LEVEL']
        new_level = LEVELS.get(new_level, logging.error)
        new_handler.setLevel(new_level)
{'fraction_non_alphanumeric': 0.11527777777777778, 'fraction_numerical': 0.009722222222222222, 'mean_word_length': 3.6318327974276525, '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': '1318403', 'n_tokens_mistral': 982, 'n_tokens_neox': 957, 'n_words': 180}