Martijn Faassen wrote:
Stefan Behnel wrote:
A way to get around this would be to set an error log in each sensible function. Hmm, I actually think that would be the right way. I'll code this up and see how it turns out.
Great! It'd be nice if threads worked with lxml, of course. One would like to have it work in a web server...
There is now a branch called error-reporting that implements this. It is partially untested, but at least the global logging and exception handling seems to work. It should potentially also work at a thread level, although the global logging may be broken there. My SVN log entry: large rewrite of the error handling API - use named class attributes for error domain, type and level - _LogEntry class represents xmlError structure - _ErrorLog collects error entries - global log collects all errors, rotates at 100 entries - API functions can be wrapped in log.connect() and log.disconnect() to provide a local error log (exemplified in XMLSchema and RelaxNG - untested) The last line refers to a local log that can be created at object instantiation time (i.e. at the end of RelaxNG.__init__() etc.). Stefan