summaryrefslogtreecommitdiff
path: root/docs/integrations/logbook.rst
blob: d42311b52b5ab64136393f3c4aaff4621a5423f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Logbook
=======

Raven provides a `logbook <http://logbook.pocoo.org>`_ handler which will pipe
messages to Sentry.

First you'll need to configure a handler::

    from raven.handlers.logbook import SentryHandler

    # Manually specify a client
    client = Client(...)
    handler = SentryHandler(client)

You can also automatically configure the default client with a DSN::

    # Configure the default client
    handler = SentryHandler('___DSN___')

Finally, bind your handler to your context::

    from raven.handlers.logbook import SentryHandler

    client = Client(...)
    sentry_handler = SentryHandler(client)
    with sentry_handler.applicationbound():
        # everything logged here will go to sentry.
        ...