Skip to content

Commit

Permalink
Configurable options for RavenClient
Browse files Browse the repository at this point in the history
  • Loading branch information
leenr committed Oct 16, 2018
1 parent 073cad3 commit c10e6c1
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions aiomisc/service/raven.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import logging
from typing import Mapping

import yarl
from aiomisc.service import Service
from raven import Client
from raven.handlers.logging import SentryHandler
from raven.transport import Transport
from raven_aiohttp import AioHttpTransport

from aiomisc.service import Service


log = logging.getLogger(__name__)

Expand All @@ -18,13 +20,16 @@ def send(self, url, data, headers):

class RavenSender(Service):
sentry_dsn = None # type: yarl.URL
client = None # type: Client
client_options = None # type: Mapping
min_level = logging.WARNING # type: int

client = None # type: Client

async def start(self):
self.client = Client(
str(self.sentry_dsn),
transport=AioHttpTransport
transport=AioHttpTransport,
**(self.client_options or {})
)

self.sentry_dsn = yarl.URL(
Expand All @@ -37,7 +42,6 @@ async def start(self):
client=self.client,
level=self.min_level
)
handler.setLevel(self.min_level)

logging.getLogger().handlers.append(
handler
Expand Down

0 comments on commit c10e6c1

Please sign in to comment.