<commit_before>import logging

import sanic

import raven
import raven_aiohttp
from raven.handlers.logging import SentryHandler


class SanicSentry:
    def __init__(self, app=None):
        self.app = None
        self.handler = None
        self.client = None
        if app is not None:
            self.init_app(app)

    def init_app(self, app: sanic.Sanic):
        self.client = raven.Client(
            dsn=app.config['SENTRY_DSN'],
            transport=raven_aiohttp.AioHttpTransport,
        )
        self.handler = SentryHandler(client=self.client, level=app.config.get('SENTRY_LEVEL', logging.ERROR))
        logger = logging.getLogger('sanic')
        logger.addHandler(self.handler)
        self.app = app
        self.app.sentry = self<commit_msg>Fix to work on Sanic 0.7<commit_after>import logging

import sanic
from sanic.log import logger

import raven
import raven_aiohttp
from raven.handlers.logging import SentryHandler


class SanicSentry:
    def __init__(self, app=None):
        self.app = None
        self.handler = None
        self.client = None
        if app is not None:
            self.init_app(app)

    def init_app(self, app: sanic.Sanic):
        self.client = raven.Client(
            dsn=app.config['SENTRY_DSN'],
            transport=raven_aiohttp.AioHttpTransport,
        )
        self.handler = SentryHandler(client=self.client, level=app.config.get('SENTRY_LEVEL', logging.ERROR))
        logger.addHandler(self.handler)
        self.app = app
        self.app.sentry = self
{'fraction_non_alphanumeric': 0.09305373525557012, 'fraction_numerical': 0.001310615989515072, 'mean_word_length': 2.5511627906976746, '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': '3167401', 'n_tokens_mistral': 480, 'n_tokens_neox': 474, 'n_words': 102}