diff options
author | David Cramer <dcramer@gmail.com> | 2017-06-28 12:07:01 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-28 12:07:01 -0700 |
commit | 8d5aadebdec608437eb7b1b7ef43c1fffe08fe3a (patch) | |
tree | 996945b29b41ff58ad6c03f6bc5f190f05728bea | |
parent | edef5f6759e6c91ea972c83be28ffb6def8195d2 (diff) | |
parent | 296259011837bc4ed49c0f3800af397e20318dc7 (diff) | |
download | raven-8d5aadebdec608437eb7b1b7ef43c1fffe08fe3a.tar.gz |
Merge pull request #1031 from arnavk/arnav/logging_signal_docs
Add docs for logging_configured signal for Flask
-rw-r--r-- | docs/integrations/flask.rst | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/docs/integrations/flask.rst b/docs/integrations/flask.rst index 8491a9d..ad3403c 100644 --- a/docs/integrations/flask.rst +++ b/docs/integrations/flask.rst @@ -202,3 +202,27 @@ This may also require `changes <http://flask.pocoo.org/docs/0.10/deploying/wsgi-standalone/#proxy-setups>`_ to the proxy configuration to pass the right headers if it isn't doing so already. + + +Signals +------- + +Raven uses `blinker <https://github.com/jek/blinker>`_ to emit a signal +(called ``logging_configured``) after logging has been configured for the +client. You may `bind to that signal <https://pythonhosted.org/blinker/#subscribing-to-signals>`_ +in your application to do any additional configuration to the logging +handler ``SentryHandler``. + +.. sourcecode:: python + + from raven.contrib.flask import Sentry, logging_configured + from flask import Flask, g, render_template + from raven.contrib.flask import Sentry + + app = Flask(__name__) + sentry = Sentry(app, dsn='___DSN___', logging=True) + + @logging_configured.connect + def internal_server_error(sender, sentry_handler=None, **kwargs): + # configure sentry_handler here + sentry_handler.addFilter(some_filter) |