Created
May 20, 2011 08:17
-
-
Save lxneng/982546 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from xmlbuilder import XMLBuilder | |
def _generate_xml(self, exception): | |
_,_,trace = sys.exc_info() | |
xml = XMLBuilder() | |
with xml.notice(version = 2.0): | |
xml << ('api-key', self.environment.api_key) | |
with xml.notifier: | |
xml << ('name', self.environment.name) | |
xml << ('version', self.environment.version) | |
xml << ('url', self.environment.url) | |
with xml('server-environment'): | |
xml << ('environment-name', self.environment.environment_name) | |
with xml.error: | |
xml << ('class', exception.__class__.__name__) | |
xml << ('message', str(exception)) | |
with xml.backtrace: | |
[xml << ('line', {'file':filename, 'number':line_number, 'method':function_name}) \ | |
for filename, line_number, function_name, _ in traceback.extract_tb(trace)] | |
return str(xml) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment