Changeset 10804 in hybrid
- Timestamp:
- May 12, 2012, 7:36:00 PM (13 years ago)
- Location:
- branches/releng-9.0/nanobsd/files/usr/local/www
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/releng-9.0/nanobsd/files/usr/local/www/wlportal/index.cgi
r10796 r10804 30 30 # Author : Rick van der Zwet <info@rickvanderzwet.nl> 31 31 # Licence : BSDLike http://wirelessleiden.nl/LICENSE 32 import cgitb 33 cgitb.enable(logdir="/tmp") 34 32 33 class MultiTracebackHook: 34 """A hook to replace sys.excepthook that shows tracebacks in syslog & HTML (using cgitb)""" 35 def __init__(self, ident=None, enable=False): 36 self.ident = ident 37 if enable: 38 self.enable() 39 40 def __call__(self, etype, evalue, etb): 41 self.handle((etype, evalue, etb)) 42 43 def handle(self, info=None): 44 import cgitb 45 import os 46 import sys 47 import syslog 48 import traceback 49 info = info or sys.exc_info() 50 tb = traceback.format_exception(*info) 51 if self.ident: 52 syslog.openlog(self.ident) 53 prefix = '[%i]' % os.getpid() 54 for line in tb: 55 syslog.syslog(line) 56 cgitb.handler(info) 57 58 def enable(self): 59 import sys 60 sys.excepthook = self 61 62 MultiTracebackHook(enable=True) 35 63 36 64 import os -
branches/releng-9.0/nanobsd/files/usr/local/www/wlweb/index.cgi
r10727 r10804 6 6 # Rick van der Zwet <info@rickvanderzwet.nl> 7 7 # Richard van Mansom <richardvm@wirelessleiden.nl>, stripped the webserver 8 import cgitb 9 cgitb.enable(logdir="/tmp") 8 9 class MultiTracebackHook: 10 """A hook to replace sys.excepthook that shows tracebacks in syslog & HTML (using cgitb)""" 11 def __init__(self, ident=None, enable=False): 12 self.ident = ident 13 if enable: 14 self.enable() 15 16 def __call__(self, etype, evalue, etb): 17 self.handle((etype, evalue, etb)) 18 19 def handle(self, info=None): 20 import cgitb 21 import os 22 import sys 23 import syslog 24 import traceback 25 info = info or sys.exc_info() 26 tb = traceback.format_exception(*info) 27 if self.ident: 28 syslog.openlog(self.ident) 29 prefix = '[%i]' % os.getpid() 30 for line in tb: 31 syslog.syslog(line) 32 cgitb.handler(info) 33 34 def enable(self): 35 import sys 36 sys.excepthook = self 37 38 MultiTracebackHook(enable=True) 10 39 11 40 from subprocess import *
Note:
See TracChangeset
for help on using the changeset viewer.