[Repoze-checkins] r1142 - in repoze.errorlog/trunk: . repoze/errorlog
Chris McDonough
chrism at agendaless.com
Thu Jun 26 18:26:03 EDT 2008
Author: Chris McDonough <chrism at agendaless.com>
Date: Thu Jun 26 18:26:03 2008
New Revision: 1142
Log:
- Remove post-mortem debug middleware (moved to repoze.debug).
- Initial PyPI release.
Modified:
repoze.errorlog/trunk/CHANGES.txt
repoze.errorlog/trunk/README.txt
repoze.errorlog/trunk/repoze/errorlog/__init__.py
repoze.errorlog/trunk/repoze/errorlog/tests.py
repoze.errorlog/trunk/setup.py
Modified: repoze.errorlog/trunk/CHANGES.txt
==============================================================================
--- repoze.errorlog/trunk/CHANGES.txt (original)
+++ repoze.errorlog/trunk/CHANGES.txt Thu Jun 26 18:26:03 2008
@@ -1,3 +1,9 @@
+0.8 (2008-06-25)
+
+ - Remove post-mortem debug middleware (moved to repoze.debug).
+
+ - Initial PyPI release.
+
0.7 (2008-05-21)
- Add post-mortem debug middleware (egg:repoze.errorlog#pdbpm)
Modified: repoze.errorlog/trunk/README.txt
==============================================================================
--- repoze.errorlog/trunk/README.txt (original)
+++ repoze.errorlog/trunk/README.txt Thu Jun 26 18:26:03 2008
@@ -1,82 +1,84 @@
repoze.errorlog README
+======================
- Overview
+Overview
+--------
- This package implements a WSGI Middleware filter which intercepts
- exceptions and writes them to a Python 'logging' module channel
- (or the 'wsgi.errors' filehandle, if no channel is configured).
- It also allows the browsing of limited exception history via a
- browser UI. It also provides middleware that allows for
- post-mortem debugging.
+This package implements a WSGI middleware filter which intercepts
+exceptions and writes them to a Python logging module channel (or the
+``wsgi.errors`` filehandle, if no channel is configured). It also
+allows the browsing of limited exception history via a browser UI. It
+also provides middleware that allows for post-mortem debugging.
- Configuration
+Configuration
+-------------
- If you want to use the default configuration, you can just include the
- filter in your application's pipeline.
+If you want to use the default configuration, you can just include the
+filter in your application's pipeline, e.g.::
- [pipeline:main]
- pipeline = egg:Paste#cgitb
- egg:repoze.errorlog#errorlog
- zope2
-
- If you want to override the default configuration, you need to
- make a separate section for the filter. The Paste configuration
- options at this time are "channel", "keep" and "path". To
- configure repoze.errorlog to use the 'Repoze' logging channel,
- which sends to the 'Repoze' logging channel, as if you had send to
- a logger from code where you did 'from logging import getLogger;
- logger = getLogger("Repoze")' and to keep 50 tracebacks around for
- through-the-web exception viewing, configure like so::
-
- [filter:errorlog]
- channel = Repoze
- keep = 50
- path = /__my_error_log__
- ignore = RuntimeError my.module:MyError
-
- By default, no channel is configured, and tracebacks are sent to
- the 'wsgi.errors' file handle (which should cause the errors to
- show up in your server's error log). By default, the exception
- history length ('keep') is 20.
-
- By default, the error log's path is '/__error_log__'; you can
- change this as necessary for your deployment.
-
- The ignore parameter prevents the exceptions named from being
- logged or kept in exception history (although they are reraised).
- By default, no exceptions are ignored.
-
- To use the reconfigured filter in the
- pipeline::
-
- [pipeline:main]
- pipeline = egg:Paste#cgitb
- errorlog
- myapp
-
- Usage
-
- To view recent tracebacks via your browser (exception history),
- visit the '/__error_log__' path at the hostname represented by
- your server. A view will be presented showing you all recent
- tracebacks. Clicking on one will bring you to a page which shows
- you the traceback and a rendering of the WSGI environment which
- was present at the time the exception occurred.
-
- Integrating
-
- When repoze.errorlog is placed into the pipeline, two keys are
- placed into the wsgi environment on every request (even when an
- exception is not raised and caught by repoze.errorlog)::
+ [pipeline:main]
+ pipeline = egg:Paste#cgitb
+ egg:repoze.errorlog#errorlog
+ yourapp
+
+If you want to override the default configuration, you need to make a
+separate section for the filter. The Paste configuration options at
+this time are ``channel``, ``keep`` and ``path``. To configure
+repoze.errorlog to use the ``Repoze`` logging channel, which sends to
+the logging channel as if you had send to a logger from code where
+you did 'from logging import getLogger; logger = getLogger("Repoze")'
+and to keep 50 tracebacks around for through-the-web exception
+viewing, configure like so::
+
+ [filter:errorlog]
+ channel = Repoze
+ keep = 50
+ path = /__my_error_log__
+ ignore = RuntimeError my.module:MyError
+
+By default, no channel is configured, and tracebacks are sent to the
+``wsgi.errors`` file handle (which should cause the errors to show up in
+your server's error log). By default, the exception history length
+('keep') is 20.
+
+By default, the error log's path is ``/__error_log__``; you can change
+this as necessary for your deployment.
+
+The ignore parameter prevents the exceptions named from being logged
+or kept in exception history (although they are reraised). By
+default, no exceptions are ignored.
+
+To use the reconfigured filter in the pipeline::
+
+ [pipeline:main]
+ pipeline = egg:Paste#cgitb
+ errorlog
+ yourapp
+
+Usage
+-----
+
+To view recent tracebacks via your browser (exception history), visit
+the ``/__error_log__`` path at the hostname represented by your server.
+A view will be presented showing you all recent tracebacks. Clicking
+on one will bring you to a page which shows you the traceback and a
+rendering of the WSGI environment which was present at the time the
+exception occurred.
+
+Integrating
+-----------
+
+When repoze.errorlog is placed into the pipeline, two keys are placed
+into the wsgi environment on every request (even when an exception is
+not raised and caught by repoze.errorlog)::
repoze.errorlog.path -- the path at which the errorlog is configured
repoze.errorlog.entryid -- the entry id of the next error
- Middleware and applications that catch exceptions can compose a
- URL to the 'current' error (for helpful development feedback) when
- they know repoze.errorlog is in the pipeline by using the
- following code::
+ Middleware and applications that catch exceptions can compose a URL
+ to the current error (for helpful development feedback) when they
+ know repoze.errorlog is in the pipeline by using the following code::
from paste.request import construct_url
path = environ['repoze.errorlog.path']
@@ -84,15 +86,9 @@
url = construct_url(environ, path_info=path,
querystring='entry=%s' % entry)
- Post-Mortem Debugging
- You will be dropped into Python's PDB post-mortem debugger if you
- run your WSGI app in the foreground and use the
- 'egg:repoze.errorlog#pdbpm' entry point in your Paste
- configuration, eg.::
-
- [pipeline:main]
- pipeline = egg:Paste#cgitb
- egg:repoze.errorlog#pdbpm
- myapp
-
+Reporting Bugs / Development Versions
+-------------------------------------
+
+Visit http://bugs.repoze.org to report bugs. Visit
+http://svn.repoze.org to download development or tagged versions.
Modified: repoze.errorlog/trunk/repoze/errorlog/__init__.py
==============================================================================
--- repoze.errorlog/trunk/repoze/errorlog/__init__.py (original)
+++ repoze.errorlog/trunk/repoze/errorlog/__init__.py Thu Jun 26 18:26:03 2008
@@ -14,7 +14,6 @@
from logging import getLogger
import os
-import pdb
import pprint
import sys
import traceback
@@ -177,19 +176,3 @@
ignored_exceptions = tuple(ignored_exceptions)
return ErrorLog(app, channel, keep, path, ignored_exceptions)
-# stolen partly from z3c.evalexception
-def PostMortemDebug(application):
- """Middleware that catches exceptions and invokes pdb's
- post-mortem debugging facility."""
- def middleware(environ, start_response):
- try:
- return application(environ, start_response)
- except:
- pdb.post_mortem(sys.exc_info()[2])
- raise
-
- return middleware
-
-def make_post_mortem_debug(app, global_conf):
- return PostMortemDebug(app)
-
Modified: repoze.errorlog/trunk/repoze/errorlog/tests.py
==============================================================================
--- repoze.errorlog/trunk/repoze/errorlog/tests.py (original)
+++ repoze.errorlog/trunk/repoze/errorlog/tests.py Thu Jun 26 18:26:03 2008
@@ -177,65 +177,6 @@
self.assertEqual(elog.errors[0].__class__, Error)
del exc_info
-class TestPDBPM(unittest.TestCase):
- def _getFUT(self):
- from repoze.errorlog import PostMortemDebug
- return PostMortemDebug
-
- def _makeOne(self, app):
- f = self._getFUT()
- return f(app)
-
- def test_post_mortem_withexc(self):
- app = DummyApplication(KeyError)
- mw = self._makeOne(app)
- fake_pdb = FakePDB()
- try:
- import repoze.errorlog
- old_pdb = repoze.errorlog.pdb
- repoze.errorlog.pdb = fake_pdb
- environ = {}
- self.assertRaises(KeyError, mw, environ, None)
- finally:
- repoze.errorlog.pdb = old_pdb
- self.assertEqual(fake_pdb.called, True)
-
- def test_post_mortem_noexc(self):
- app = DummyApplication()
- mw = self._makeOne(app)
- fake_pdb = FakePDB()
- try:
- import repoze.errorlog
- old_pdb = repoze.errorlog.pdb
- repoze.errorlog.pdb = fake_pdb
- environ = {}
- result = mw(environ, None)
- finally:
- repoze.errorlog.pdb = old_pdb
- self.assertEqual(fake_pdb.called, False)
- self.assertEqual(result, ['hello world'])
-
- def test_paste_constructor(self):
- app = DummyApplication()
- from repoze.errorlog import make_post_mortem_debug
- mw = make_post_mortem_debug(app, None)
- fake_pdb = FakePDB()
- try:
- import repoze.errorlog
- old_pdb = repoze.errorlog.pdb
- repoze.errorlog.pdb = fake_pdb
- environ = {}
- result = mw(environ, None)
- finally:
- repoze.errorlog.pdb = old_pdb
- self.assertEqual(fake_pdb.called, False)
- self.assertEqual(result, ['hello world'])
-
-class FakePDB:
- called = False
- def post_mortem(self, *args):
- self.called = True
-
class DummyApplication:
def __init__(self, exc=None):
self.exc = exc
@@ -250,8 +191,3 @@
class DummyException(Exception):
pass
-def test_suite():
- return unittest.findTestCases(sys.modules[__name__])
-
-if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')
Modified: repoze.errorlog/trunk/setup.py
==============================================================================
--- repoze.errorlog/trunk/setup.py (original)
+++ repoze.errorlog/trunk/setup.py Thu Jun 26 18:26:03 2008
@@ -12,7 +12,7 @@
#
##############################################################################
-__version__ = '0.7'
+__version__ = '0.8'
import os
@@ -23,11 +23,12 @@
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.txt')).read()
+CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()
setup(name='repoze.errorlog',
version=__version__,
description='Error logging and reporting middleware',
- long_description=README,
+ long_description=README + '\n\n' + CHANGES,
classifiers=[
"Development Status :: 2 - Alpha",
"Intended Audience :: Developers",
@@ -60,7 +61,6 @@
entry_points = """\
[paste.filter_app_factory]
errorlog = repoze.errorlog:make_errorlog
- pdbpm = repoze.errorlog:make_post_mortem_debug
"""
)
More information about the Repoze-checkins
mailing list