Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 1885

Show
Ignore:
Timestamp:
02/04/08 20:49:49
Author:
fumanchu
Message:

Added a 'severity' arg to the log_tracebacks tool.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/lib/cptools.py

    r1811 r1885  
    11"""Functions for builtin CherryPy tools.""" 
    22 
     3import logging 
    34import md5 
    45import re 
     
    165166def referer(pattern, accept=True, accept_missing=False, error=403, 
    166167            message='Forbidden Referer header.'): 
    167     """Raise HTTPError if Referer header does not pass our test
     168    """Raise HTTPError if Referer header does/does not match the given pattern
    168169     
    169170    pattern: a regular expression pattern to test against the Referer. 
     
    287288 
    288289 
    289 def log_traceback(): 
     290def log_traceback(severity=logging.DEBUG): 
    290291    """Write the last error's traceback to the cherrypy error log.""" 
    291292    from cherrypy import _cperror 
    292     cherrypy.log(_cperror.format_exc(), "HTTP"
     293    cherrypy.log(_cperror.format_exc(), "HTTP", severity=severity
    293294 
    294295def log_request_headers(): 

Hosted by WebFaction

Log in as guest/cpguest to create tickets