Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install cipher.logview

How to install cipher.logview

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install cipher.logview
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
Windows (64-bit)
Mac OS X (10.5+)
1.1.0 Available View build log
Linux (32-bit)
1.1.0 Available View build log
Linux (64-bit)
1.1.0 Available View build log
1.1.0 Available View build log
 
License
MIT
Dependencies
Lastest release
version 1.1.0 on Mar 26th, 2013

cipher.logview

WSGI middleware that shows you log messages produced during request handling.

Wraps Dozer and adds a few features:

  • Pretty request timeline for functions decorated with @cipher.logview.timed.
  • Stack formatter shows the value of __traceback_info__ in each stack frame, if a local with that name exists (which is a convention used by zope.exceptions.exceptionformatter).
  • A monkey-patch for zope.browserpage's ViewPageTemplateFile that logs the names of page templates being rendered (enable with monkeypatch=True).
  • A monkey-patch for zope.app.publication's ZopePublication that logs the name of the view class that is being called, and also the representation of and interfaces provided by the content object (enable with monkeypatch=True).
Usage

Add cipher.logview.LogviewMiddleware in your WSGI pipeline.

For example, here's an excerpt for a PasteDeploy-style paster.ini:

[filter-app:logview]
use = egg:cipher.logview
next = main
loglevel = DEBUG
keep_tracebacks = yes
monkeypatch = yes

# highlighting rules: logview.substring = css-color
logview.sql = #fee
logview.txn = #efe

# traceback highlighting rules: traceback.substring=css-color
traceback.dozer/ = #ddd
traceback.python2.7/ = #ccc
traceback.paste/ = #bbb
traceback.webob/ = #aaa
traceback.weberror/ = #999
traceback.zope/ = #888
traceback.z3c/ = #888
traceback.storm/ = #777
traceback.transaction/ = #666
traceback.ZODB/ = #555
traceback.keas/ = #444
traceback.cipher/ = #840

which lets you optionally enable the middleware from the command line

bin/paster serve paster.ini -n logview

Note: if you want to see debug messages -- such as those produced by cipher.logview itself -- you will need to make sure the logging level of the root logger is set to DEBUG. If you don't want debug messages in your log files (and who does?), filter them out by setting the level of each handler. Example paster.ini:

[logging]
keys = root, ...

[logger_root]
handlers = stdout, logfile
level = DEBUG

[handlers]
keys = stdout, logfile, ...

[handler_stdout]
class = StreamHandler
args = (sys.stdout,)
level = INFO
formatter = ...

[handler_logfile]
class = logging.handlers.RotatingFileHandler
args = ('events.log', 'a', 10*1024*1024, 5)
level = INFO
formatter = ...

Changes

1.1.0 (2013-03-22)
  • Add support for Python 3.3.
  • Require Dozer 0.4.
  • No longer require Paste.
  • Cosmetic fix: add the missing closing parenthesis to the request timeline labels.
1.0.2 (2012-12-13)
  • Handle views that are methods (e.g. <browser:page class="..." attribute="..." />): show the class and method name, the correct source location of the method, and the context. Previously you'd see "Calling __builtin__.instancemethod - no source information available".
  • Add cipher.logview.format_tb. Use it to format exception tracebacks (requires Dozer 0.3).
  • Add support for __traceback_supplement__ in format_stack/format_tb. This is used by Zope Page Templates to indicate the page template filename/line/column/expression.
1.0.1 (2012-12-07)
  • Handle dynamic subclasses created by <browser:page> and show the real class.
  • Bugfix: sometimes enumerating interfaces of the context could trigger a ForbiddenAttribute exception.
  • Mention logging levels gotcha in README.rst.
1.0.0 (2012-12-05)
  • First public release.

Subscribe to package updates

Last updated Mar 26th, 2013

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.