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

Changeset 1097

Show
Ignore:
Timestamp:
05/07/06 16:50:19
Author:
fumanchu
Message:

Renamed _cp_log_message to "_cputil.log", and moved its customization from a special attribute to a config entry ('log_function'). Since that was the last special attribute, removed _cputil.get_special_attribute entirely.

Files:

Legend:

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

    r1096 r1097  
    104104    # to allow profiler and coverage tools to work on it. 
    105105    import _cputil, _cperror 
    106     logfunc = _cputil.get_special_attribute('_cp_log_message'
     106    logfunc = config.get('log_function', _cputil.log
    107107     
    108108    if traceback: 
  • trunk/cherrypy/_cputil.py

    r1096 r1097  
    104104 
    105105 
    106 def get_special_attribute(name): 
    107     """Return the special attribute. A special attribute is one that 
    108     applies to all of the children from where it is defined.""" 
    109      
    110     # First, we look in the right-most object to see if this special 
    111     # attribute is implemented. If not, then we try the previous object, 
    112     # and so on until we reach app.root (a mount point). 
    113     # If it's still not there, we use the implementation from this module. 
    114     objectList = get_object_trail() 
    115     objectList.reverse() 
    116     for objname, obj in objectList: 
    117         if hasattr(obj, name): 
    118             return getattr(obj, name) 
    119      
    120     try: 
    121         return globals()[name] 
    122     except KeyError: 
    123         msg = "Special attribute %s could not be found" % repr(name) 
    124         raise cherrypy.HTTPError(500, msg) 
    125  
    126106def logtime(): 
    127107    now = datetime.datetime.now() 
     
    157137_log_severity_levels = {0: "INFO", 1: "WARNING", 2: "ERROR"} 
    158138 
    159 def _cp_log_message(msg, context = '', severity = 0): 
     139def log(msg, context = '', severity = 0): 
    160140    """Default method for logging messages (error log). 
    161141     

Hosted by WebFaction

Log in as guest/cpguest to create tickets