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

Changeset 887

Show
Ignore:
Timestamp:
12/28/05 16:27:38
Author:
fumanchu
Message:

New signature for cherrypy.log.

Files:

Legend:

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

    r856 r887  
    8282        return expose_ 
    8383 
    84 def log(msg, context='', severity=0): 
     84def log(msg='', context='', severity=0, traceback=False): 
    8585    """Syntactic sugar for writing to the (error) log.""" 
    8686    # Load _cputil lazily to avoid circular references, and 
     
    8888    import _cputil 
    8989    logfunc = _cputil.get_special_attribute('_cp_log_message', '_cpLogMessage') 
     90     
     91    if traceback: 
     92        msg += _cputil.formatExc() 
     93     
    9094    logfunc(msg, context, severity) 
    9195 
  • trunk/cherrypy/_cphttpserver.py

    r884 r887  
    5050        except httptools.MaxSizeExceeded: 
    5151            self.send_error(413, "Request Entity Too Large") 
    52             tb = _cputil.formatExc() 
    53             cherrypy.log(tb) 
     52            cherrypy.log(traceback=True) 
    5453            return False 
    5554        else: 
     
    141140                    request.close() 
    142141            except: 
    143                 cherrypy.log(_cputil.formatExc()
     142                cherrypy.log(traceback=True
    144143            raise ex 
    145144        except: 
    146             tb = _cputil.formatExc(
     145            cherrypy.log(traceback=True
    147146            try: 
    148147                if request: 
    149148                    request.close() 
    150149            except: 
    151                 cherrypy.log(_cputil.formatExc()
    152             cherrypy.log(tb) 
     150                cherrypy.log(traceback=True
     151             
    153152            s, h, b = _cputil.bareError() 
    154153            # CherryPy test suite expects bareError body to be output, 
     
    286285     
    287286    def handle_error(self, request, client_address): 
    288         cherrypy.log(_cputil.formatExc()
     287        cherrypy.log(traceback=True
    289288     
    290289    def serve_forever(self): 
     
    389388                        raise 
    390389                    except: 
    391                         cherrypy.log(_cputil.formatExc()
     390                        cherrypy.log(traceback=True
    392391                finally: 
    393392                    request.close() 
  • trunk/cherrypy/_cphttptools.py

    r886 r887  
    3838                raise 
    3939            except: 
    40                 cherrypy.log(_cputil.formatExc()
     40                cherrypy.log(traceback=True
    4141     
    4242    def run(self, requestLine, headers, rfile): 
  • trunk/cherrypy/_cputil.py

    r886 r887  
    356356    if (not cherrypy.config.get('server.log_tracebacks', True) 
    357357        and cherrypy.config.get('server.log_unhandled_tracebacks', True)): 
    358         cherrypy.log(formatExc()
     358        cherrypy.log(traceback=True
    359359     
    360360    cherrypy.HTTPError(500).set_response() 
  • trunk/cherrypy/_cpwsgi.py

    r884 r887  
    102102                request.close() 
    103103        except: 
    104             cherrypy.log(_cputil.formatExc()
     104            cherrypy.log(traceback=True
    105105        raise ex 
    106106    except: 
    107         tb = _cputil.formatExc(
     107        cherrypy.log(traceback=True
    108108        try: 
    109109            if request: 
    110110                request.close() 
    111111        except: 
    112             cherrypy.log(_cputil.formatExc()) 
    113         cherrypy.log(tb) 
     112            cherrypy.log(traceback=True) 
    114113        s, h, b = _cputil.bareError() 
    115114        # CherryPy test suite expects bareError body to be output, 
     
    143142            self.ready = False 
    144143             
    145             tb = _cputil.formatExc() 
    146             cherrypy.log(tb) 
     144            cherrypy.log(traceback=True) 
    147145        else: 
    148146            if self.ready: 

Hosted by WebFaction

Log in as guest/cpguest to create tickets