backlash


Namebacklash JSON
Version 0.3.2 PyPI version JSON
download
home_pagehttps://github.com/TurboGears/backlash
SummaryStandalone WebOb port of the Werkzeug Debugger with Python3 support meant to replace WebError in future TurboGears2
upload_time2024-03-15 21:22:03
maintainer
docs_urlNone
authorAlessandro Molina
requires_python
licenseMIT
keywords wsgi
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            About backlash
-------------------------

backlash is a swiss army knife for web applications debugging, which provides:

    - An Interactive In Browser Debugger based on a Werkzeug Debugger fork ported to WebOb
    - Crash reporting by email and on Sentry
    - Slow requests reporting by email and on Sentry.

Backlash was born as a replacement for WebError in TurboGears2.3 versions.

Installing
-------------------------------

backlash can be installed from pypi::

    pip install backlash

should just work for most of the users

Debugging and Console
----------------------------------

Backlash supports both debugging applications on crash and realtime console,
both are based on the Werkzeug Debugger and adapted to work with WebOb.

The debugging function is provided by the ``DebuggedApplication`` middleware,
wrapping your application with this middleware will intercept any exception
and display the traceback and an interactive console in your browser.

An interactive console will also be always available at ``/__console__`` path.

Context Injectors
+++++++++++++++++++++++++++++

The ``DebuggedApplication`` middleware also makes possible to provide one or more
``context injectors``, those are simple python functions that will be called when
an exception is raised to retrieve the context to store and make back available during
debugging.

Context injectors have to return a dictionary which will be merged into the current
request context, the request context itself will be made available inside the debugger
as the ``ctx`` object.

This feature is used for example by TurboGears to provide back some of the objects
which were available during execution like the current request.

Example
+++++++++++++++++++++++++++++++

The DebuggedApplication middleware is used by TurboGears in the following way::

    def _turbogears_backlash_context(environ):
        tgl = environ.get('tg.locals')
        return {'request':getattr(tgl, 'request', None)}

    app = backlash.DebuggedApplication(app, context_injectors=[_turbogears_backlash_context])


Exception Tracing
---------------------------------------

The ``TraceErrorsMiddleware`` provides a WSGI middleware that intercepts any exception
raised during execution, retrieves a traceback object and provides it to one or more
``reporters`` to log the error.

By default the ``EmailReporter`` and ``SentryReporter`` are provided to send error
reports by email and on Sentry.

The ``EmailReporter`` supports most of the options WebError ErrorMiddleware to provide some
kind of backward compatibility and make possible a quick transition.

While this function is easily replicable using the python logging SMTPHandler, the
TraceErrorsMiddleware is explicitly meant for web applications crash reporting
which has the benefit of being able to provide more complete information and keep a clear
and separate process in managing errors.

Example
++++++++++++++++++++++++++++++++

The TraceErrorsMiddleware is used by TurboGears in the following way::

    from backlash.trace_errors import EmailReporter

    def _turbogears_backlash_context(environ):
       tgl = environ.get('tg.locals')
       return {'request':getattr(tgl, 'request', None)}

    app = backlash.TraceErrorsMiddleware(app, [EmailReporter(**errorware)],
                                         context_injectors=[_turbogears_backlash_context])

Slow Requests Tracing
---------------------------------------

The ``TraceSlowRequestsMiddleware`` provides a WSGI middleware that tracks requests
execution time and reports requests that took more than a specified interval to complete
(by default 25 seconds).

It is also possible to exclude a list of paths that start with a specified string
to avoid reporting long polling connections or other kind of requests that are
expected to have a long life spawn.

Example
++++++++++++++++++++++++++++++++

The TraceSlowRequestsMiddleware is used by TurboGears in the following way::

    from backlash.trace_errors import EmailReporter

    def _turbogears_backlash_context(environ):
       tgl = environ.get('tg.locals')
       return {'request':getattr(tgl, 'request', None)}

    app = backlash.TraceSlowRequestsMiddleware(app, [EmailReporter(**errorware)],
                                               interval=25, exclude_paths=None,
                                               context_injectors=[_turbogears_backlash_context])



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/TurboGears/backlash",
    "name": "backlash",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "wsgi",
    "author": "Alessandro Molina",
    "author_email": "amol@turbogears.org",
    "download_url": "https://files.pythonhosted.org/packages/dc/b0/cb16bf831dbf45760ed477e36dcc9a577da082d2d3c84197a7caf4e961d7/backlash-0.3.2.tar.gz",
    "platform": null,
    "description": "About backlash\n-------------------------\n\nbacklash is a swiss army knife for web applications debugging, which provides:\n\n    - An Interactive In Browser Debugger based on a Werkzeug Debugger fork ported to WebOb\n    - Crash reporting by email and on Sentry\n    - Slow requests reporting by email and on Sentry.\n\nBacklash was born as a replacement for WebError in TurboGears2.3 versions.\n\nInstalling\n-------------------------------\n\nbacklash can be installed from pypi::\n\n    pip install backlash\n\nshould just work for most of the users\n\nDebugging and Console\n----------------------------------\n\nBacklash supports both debugging applications on crash and realtime console,\nboth are based on the Werkzeug Debugger and adapted to work with WebOb.\n\nThe debugging function is provided by the ``DebuggedApplication`` middleware,\nwrapping your application with this middleware will intercept any exception\nand display the traceback and an interactive console in your browser.\n\nAn interactive console will also be always available at ``/__console__`` path.\n\nContext Injectors\n+++++++++++++++++++++++++++++\n\nThe ``DebuggedApplication`` middleware also makes possible to provide one or more\n``context injectors``, those are simple python functions that will be called when\nan exception is raised to retrieve the context to store and make back available during\ndebugging.\n\nContext injectors have to return a dictionary which will be merged into the current\nrequest context, the request context itself will be made available inside the debugger\nas the ``ctx`` object.\n\nThis feature is used for example by TurboGears to provide back some of the objects\nwhich were available during execution like the current request.\n\nExample\n+++++++++++++++++++++++++++++++\n\nThe DebuggedApplication middleware is used by TurboGears in the following way::\n\n    def _turbogears_backlash_context(environ):\n        tgl = environ.get('tg.locals')\n        return {'request':getattr(tgl, 'request', None)}\n\n    app = backlash.DebuggedApplication(app, context_injectors=[_turbogears_backlash_context])\n\n\nException Tracing\n---------------------------------------\n\nThe ``TraceErrorsMiddleware`` provides a WSGI middleware that intercepts any exception\nraised during execution, retrieves a traceback object and provides it to one or more\n``reporters`` to log the error.\n\nBy default the ``EmailReporter`` and ``SentryReporter`` are provided to send error\nreports by email and on Sentry.\n\nThe ``EmailReporter`` supports most of the options WebError ErrorMiddleware to provide some\nkind of backward compatibility and make possible a quick transition.\n\nWhile this function is easily replicable using the python logging SMTPHandler, the\nTraceErrorsMiddleware is explicitly meant for web applications crash reporting\nwhich has the benefit of being able to provide more complete information and keep a clear\nand separate process in managing errors.\n\nExample\n++++++++++++++++++++++++++++++++\n\nThe TraceErrorsMiddleware is used by TurboGears in the following way::\n\n    from backlash.trace_errors import EmailReporter\n\n    def _turbogears_backlash_context(environ):\n       tgl = environ.get('tg.locals')\n       return {'request':getattr(tgl, 'request', None)}\n\n    app = backlash.TraceErrorsMiddleware(app, [EmailReporter(**errorware)],\n                                         context_injectors=[_turbogears_backlash_context])\n\nSlow Requests Tracing\n---------------------------------------\n\nThe ``TraceSlowRequestsMiddleware`` provides a WSGI middleware that tracks requests\nexecution time and reports requests that took more than a specified interval to complete\n(by default 25 seconds).\n\nIt is also possible to exclude a list of paths that start with a specified string\nto avoid reporting long polling connections or other kind of requests that are\nexpected to have a long life spawn.\n\nExample\n++++++++++++++++++++++++++++++++\n\nThe TraceSlowRequestsMiddleware is used by TurboGears in the following way::\n\n    from backlash.trace_errors import EmailReporter\n\n    def _turbogears_backlash_context(environ):\n       tgl = environ.get('tg.locals')\n       return {'request':getattr(tgl, 'request', None)}\n\n    app = backlash.TraceSlowRequestsMiddleware(app, [EmailReporter(**errorware)],\n                                               interval=25, exclude_paths=None,\n                                               context_injectors=[_turbogears_backlash_context])\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Standalone WebOb port of the Werkzeug Debugger with Python3 support meant to replace WebError in future TurboGears2",
    "version": "0.3.2",
    "project_urls": {
        "Homepage": "https://github.com/TurboGears/backlash"
    },
    "split_keywords": [
        "wsgi"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dcb0cb16bf831dbf45760ed477e36dcc9a577da082d2d3c84197a7caf4e961d7",
                "md5": "c64d82bb6b35c7f28cac3b26e2c828f4",
                "sha256": "a6bd24f4bdea8704f6dd7b87dc3d604dacaa41f03c0fbf4252b3b71d1af4e5ac"
            },
            "downloads": -1,
            "filename": "backlash-0.3.2.tar.gz",
            "has_sig": false,
            "md5_digest": "c64d82bb6b35c7f28cac3b26e2c828f4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 177808,
            "upload_time": "2024-03-15T21:22:03",
            "upload_time_iso_8601": "2024-03-15T21:22:03.271238Z",
            "url": "https://files.pythonhosted.org/packages/dc/b0/cb16bf831dbf45760ed477e36dcc9a577da082d2d3c84197a7caf4e961d7/backlash-0.3.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-15 21:22:03",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "TurboGears",
    "github_project": "backlash",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "backlash"
}
        
Elapsed time: 0.20341s