python-pylons.json 5.4 KB

123456
  1. {
  2. "html": "<div class=\"section\" id=\"installation\">\n<h2>Installation</h2>\n<p>If you haven&#8217;t already, start by downloading Raven. The easiest way is\nwith <em>pip</em>:</p>\n<div class=\"highlight-python\"><div class=\"highlight\" style=\"background: #ffffff\"><pre style=\"line-height: 125%\"><span></span>pip install raven --upgrade\n</pre></div>\n</div>\n</div>\n\n\n<div class=\"section\" id=\"wsgi-middleware\">\n<h2>WSGI Middleware</h2>\n<p>A Pylons-specific middleware exists to enable easy configuration from settings:</p>\n<div class=\"highlight-python\"><div class=\"highlight\" style=\"background: #ffffff\"><pre style=\"line-height: 125%\"><span></span><span style=\"color: #2eb0f7\">from</span> <span style=\"color: #111111\">raven.contrib.pylons</span> <span style=\"color: #2eb0f7\">import</span> <span style=\"color: #111111\">Sentry</span>\n\n<span style=\"color: #111111\">application</span> <span style=\"color: #4b4f5c\">=</span> <span style=\"color: #111111\">Sentry(application,</span> <span style=\"color: #111111\">config)</span>\n</pre></div>\n</div>\n<p>Configuration is handled via the sentry namespace:</p>\n<div class=\"highlight-ini\"><div class=\"highlight\" style=\"background: #ffffff\"><pre style=\"line-height: 125%\"><span></span><span style=\"color: #2eb0f7\">[sentry]</span>\n<span style=\"color: #a47ac6\">dsn</span><span style=\"color: #4b4f5c\">=</span><span style=\"color: #e8535a\">___DSN___</span>\n<span style=\"color: #a47ac6\">include_paths</span><span style=\"color: #4b4f5c\">=</span><span style=\"color: #e8535a\">my.package,my.other.package,</span>\n<span style=\"color: #a47ac6\">exclude_paths</span><span style=\"color: #4b4f5c\">=</span><span style=\"color: #e8535a\">my.package.crud</span>\n</pre></div>\n</div>\n</div>\n\n\n<div class=\"section\" id=\"logger-setup\">\n<h2>Logger setup</h2>\n<p>Add the following lines to your project&#8217;s <cite>.ini</cite> file to setup <cite>SentryHandler</cite>:</p>\n<div class=\"highlight-ini\"><div class=\"highlight\" style=\"background: #ffffff\"><pre style=\"line-height: 125%\"><span></span><span style=\"color: #2eb0f7\">[loggers]</span>\n<span style=\"color: #a47ac6\">keys</span> <span style=\"color: #4b4f5c\">=</span> <span style=\"color: #e8535a\">root, sentry</span>\n\n<span style=\"color: #2eb0f7\">[handlers]</span>\n<span style=\"color: #a47ac6\">keys</span> <span style=\"color: #4b4f5c\">=</span> <span style=\"color: #e8535a\">console, sentry</span>\n\n<span style=\"color: #2eb0f7\">[formatters]</span>\n<span style=\"color: #a47ac6\">keys</span> <span style=\"color: #4b4f5c\">=</span> <span style=\"color: #e8535a\">generic</span>\n\n<span style=\"color: #2eb0f7\">[logger_root]</span>\n<span style=\"color: #a47ac6\">level</span> <span style=\"color: #4b4f5c\">=</span> <span style=\"color: #e8535a\">INFO</span>\n<span style=\"color: #a47ac6\">handlers</span> <span style=\"color: #4b4f5c\">=</span> <span style=\"color: #e8535a\">console, sentry</span>\n\n<span style=\"color: #2eb0f7\">[logger_sentry]</span>\n<span style=\"color: #a47ac6\">level</span> <span style=\"color: #4b4f5c\">=</span> <span style=\"color: #e8535a\">WARN</span>\n<span style=\"color: #a47ac6\">handlers</span> <span style=\"color: #4b4f5c\">=</span> <span style=\"color: #e8535a\">console</span>\n<span style=\"color: #a47ac6\">qualname</span> <span style=\"color: #4b4f5c\">=</span> <span style=\"color: #e8535a\">sentry.errors</span>\n<span style=\"color: #a47ac6\">propagate</span> <span style=\"color: #4b4f5c\">=</span> <span style=\"color: #e8535a\">0</span>\n\n<span style=\"color: #2eb0f7\">[handler_console]</span>\n<span style=\"color: #a47ac6\">class</span> <span style=\"color: #4b4f5c\">=</span> <span style=\"color: #e8535a\">StreamHandler</span>\n<span style=\"color: #a47ac6\">args</span> <span style=\"color: #4b4f5c\">=</span> <span style=\"color: #e8535a\">(sys.stderr,)</span>\n<span style=\"color: #a47ac6\">level</span> <span style=\"color: #4b4f5c\">=</span> <span style=\"color: #e8535a\">NOTSET</span>\n<span style=\"color: #a47ac6\">formatter</span> <span style=\"color: #4b4f5c\">=</span> <span style=\"color: #e8535a\">generic</span>\n\n<span style=\"color: #2eb0f7\">[handler_sentry]</span>\n<span style=\"color: #a47ac6\">class</span> <span style=\"color: #4b4f5c\">=</span> <span style=\"color: #e8535a\">raven.handlers.logging.SentryHandler</span>\n<span style=\"color: #a47ac6\">args</span> <span style=\"color: #4b4f5c\">=</span> <span style=\"color: #e8535a\">(&#39;SENTRY_DSN&#39;,)</span>\n<span style=\"color: #a47ac6\">level</span> <span style=\"color: #4b4f5c\">=</span> <span style=\"color: #e8535a\">NOTSET</span>\n<span style=\"color: #a47ac6\">formatter</span> <span style=\"color: #4b4f5c\">=</span> <span style=\"color: #e8535a\">generic</span>\n\n<span style=\"color: #2eb0f7\">[formatter_generic]</span>\n<span style=\"color: #a47ac6\">format</span> <span style=\"color: #4b4f5c\">=</span> <span style=\"color: #e8535a\">%(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s</span>\n<span style=\"color: #a47ac6\">datefmt</span> <span style=\"color: #4b4f5c\">=</span> <span style=\"color: #e8535a\">%H:%M:%S</span>\n</pre></div>\n</div>\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">You may want to setup other loggers as well.</p>\n</div>\n</div>\n",
  3. "link": "https://docs.getsentry.com/clients/python/integrations/pylons/",
  4. "id": "python-pylons",
  5. "name": "Pylons"
  6. }