Package elisa :: Package core :: Package utils :: Module exception_hook :: Class ExceptionHook
[hide private]
[frames] | no frames]

Class ExceptionHook

source code


Exception handler with detailled error reporting support.

Extends cgitb.Hook, add a boolean display option indicating wether errors should be displayed on stderr or not. Additionnally, each detailled error report is written to a file on disk on logdir directory.

Use it like this:
 >>> sys.excepthook = ExceptionHook(format='text', logdir='/tmp',
 ...                                file=sys.stderr, display=False)


Instance Methods [hide private]
 
__init__(self, display=1, logdir='frontend', context=5, file='frontend', format='text') source code
 
handle(self, info='frontend')
add-on to default cgitb.handle():...
source code

Inherited from cgitb.Hook: __call__

Inherited from extern.log.log.Loggable: debug, doLog, error, info, log, logFunction, logObjectName, warning, warningFailure

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Variables [hide private]

Inherited from extern.log.log.Loggable: logCategory

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, display=1, logdir='frontend', context=5, file='frontend', format='text')
(Constructor)

source code 
Overrides: cgitb.Hook.__init__

handle(self, info='frontend')

source code 
add-on to default cgitb.handle():

- if logdir doesn't exists, create it
- if logdir is set, write error report in a text or html file,
  depending on self.format

Overrides: cgitb.Hook.handle