Changeset 1097
- Timestamp:
- 05/07/06 16:50:19
- Files:
-
- trunk/cherrypy/__init__.py (modified) (1 diff)
- trunk/cherrypy/_cputil.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/__init__.py
r1096 r1097 104 104 # to allow profiler and coverage tools to work on it. 105 105 import _cputil, _cperror 106 logfunc = _cputil.get_special_attribute('_cp_log_message')106 logfunc = config.get('log_function', _cputil.log) 107 107 108 108 if traceback: trunk/cherrypy/_cputil.py
r1096 r1097 104 104 105 105 106 def get_special_attribute(name):107 """Return the special attribute. A special attribute is one that108 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 special111 # 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 126 106 def logtime(): 127 107 now = datetime.datetime.now() … … 157 137 _log_severity_levels = {0: "INFO", 1: "WARNING", 2: "ERROR"} 158 138 159 def _cp_log_message(msg, context = '', severity = 0):139 def log(msg, context = '', severity = 0): 160 140 """Default method for logging messages (error log). 161 141

