Beispiel #1
0
def get_sentry_client():
    if config.SENTRY_URL:  # pragma: no cover
        sentry_client = raven.Client(config.SENTRY_URL,
                                     transport=HTTPTransport)
        handler = raven_logging.SentryHandler(client=sentry_client)
        handler.setLevel(logging.ERROR)
        logging.getLogger(None).addHandler(handler)
        return sentry_client
Beispiel #2
0
def setup_sentry_logging(sentry_dsn):
    """Set up logging with sentry."""

    logging.basicConfig()
    if not sentry_dsn:
        raise ValueError()
    client = raven.Client(sentry_dsn)
    handler = raven_logging.SentryHandler(client)
    handler.setLevel(logging.WARNING)
    raven_conf.setup_logging(handler)