python-pyramid.json 6.6 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=\"pastedeploy-filter\">\n<h2>PasteDeploy Filter</h2>\n<p>A filter factory for <a class=\"reference external\" href=\"https://pastedeploy.readthedocs.io/en/latest/\">PasteDeploy</a> exists to allow easily inserting Raven into a WSGI pipeline:</p>\n<div class=\"highlight-ini\"><div class=\"highlight\" style=\"background: #ffffff\"><pre style=\"line-height: 125%\"><span></span><span style=\"color: #2eb0f7\">[pipeline:main]</span>\n<span style=\"color: #a47ac6\">pipeline</span> <span style=\"color: #4b4f5c\">=</span><span style=\"color: #e8535a\"></span>\n<span style=\"color: #e8535a\"> raven</span>\n<span style=\"color: #e8535a\"> tm</span>\n<span style=\"color: #e8535a\"> MyApp</span>\n\n<span style=\"color: #2eb0f7\">[filter:raven]</span>\n<span style=\"color: #a47ac6\">use</span> <span style=\"color: #4b4f5c\">=</span> <span style=\"color: #e8535a\">egg:raven#raven</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<p>In the <code class=\"docutils literal\"><span class=\"pre\">[filter:raven]</span></code> section, you must specify the entry-point for raven with the <code class=\"docutils literal\"><span class=\"pre\">use</span> <span class=\"pre\">=</span></code> key. All other raven client parameters can be included in this section as well.</p>\n<p>See the <a class=\"reference external\" href=\"http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/paste.html\">Pyramid PasteDeploy Configuration Documentation</a> for more information.</p>\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;___DSN___&#39;,)</span>\n<span style=\"color: #a47ac6\">level</span> <span style=\"color: #4b4f5c\">=</span> <span style=\"color: #e8535a\">WARNING</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. See the <a class=\"reference external\" href=\"http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html\">Pyramid Logging Documentation</a> for more information.</p>\n</div>\n<p>Instead of defining the DSN in the <cite>.ini</cite> file you can also use the environment variable <code class=\"docutils literal\"><span class=\"pre\">SENTRY_DSN</span></code> which overwrites the setting in this file. Because of a syntax check you cannot remove the <code class=\"docutils literal\"><span class=\"pre\">args</span></code> setting completely, as workaround you can define an empty list of arguments <code class=\"docutils literal\"><span class=\"pre\">args</span> <span class=\"pre\">=</span> <span class=\"pre\">()</span></code>.</p>\n</div>\n",
  3. "link": "https://docs.getsentry.com/clients/python/integrations/pyramid/",
  4. "id": "python-pyramid",
  5. "name": "Pyramid"
  6. }