Add docs to demonstrate logging exclusions

This commit is contained in:
Arnav Kumar 2016-01-25 13:18:35 +08:00
parent 0de40e8e19
commit 76042258f1
2 changed files with 14 additions and 2 deletions

View File

@ -30,7 +30,8 @@ You can optionally configure logging too::
import logging
from raven.contrib.flask import Sentry
sentry = Sentry(app, logging=True, level=logging.ERROR)
sentry = Sentry(app, logging=True, level=logging.ERROR, \
logging_exclusions=("logger1", "logger2", ...))
Building applications on the fly? You can use Raven's ``init_app`` hook::
@ -48,7 +49,8 @@ You can pass parameters in the ``init_app`` hook::
def create_app():
app = Flask(__name__)
sentry.init_app(app, dsn='___DSN___', logging=True,
level=logging.ERROR)
level=logging.ERROR,
logging_exclusions=("logger1", "logger2", ...))
return app
Settings

View File

@ -132,3 +132,13 @@ message within Sentry::
logger.error('There was some %s error', 'crazy')
logger.error('There was some %s error', 'fun')
logger.error('There was some %s error', 1)
Exclusions
~~~~~~~~~~
You can also configure some logging exclusions during setup. These loggers
will not propagate their logs to the Sentry handler.
from raven.conf import setup_logging
setup_logging(handler, exclude=("logger1", "logger2", ...))