summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Fritz <nathan@andyet.net>2010-07-26 18:13:54 -0700
committerNathan Fritz <nathan@andyet.net>2010-07-26 18:13:54 -0700
commit2b6454786ace5f9cc585fd30f1337809f2107bf8 (patch)
tree585768e41d2f59463c9f79592370a4c60f8a134a
parenta349a2a317a6ca7152e0adb21d5fabbfd632ebaf (diff)
parentc8989c04f3675235e3ae730cb240e2154b5d9e76 (diff)
downloadslixmpp-2b6454786ace5f9cc585fd30f1337809f2107bf8.tar.gz
slixmpp-2b6454786ace5f9cc585fd30f1337809f2107bf8.tar.bz2
slixmpp-2b6454786ace5f9cc585fd30f1337809f2107bf8.tar.xz
slixmpp-2b6454786ace5f9cc585fd30f1337809f2107bf8.zip
Merge branch 'experimental' of git@github.com:fritzy/SleekXMPP into experimental
-rw-r--r--sleekxmpp/plugins/xep_0050.py1
-rw-r--r--sleekxmpp/stanza/rootstanza.py2
-rw-r--r--sleekxmpp/xmlstream/stanzabase.py3
-rw-r--r--sleekxmpp/xmlstream/xmlstream.py12
4 files changed, 8 insertions, 10 deletions
diff --git a/sleekxmpp/plugins/xep_0050.py b/sleekxmpp/plugins/xep_0050.py
index 4ff42859..5efb9116 100644
--- a/sleekxmpp/plugins/xep_0050.py
+++ b/sleekxmpp/plugins/xep_0050.py
@@ -9,7 +9,6 @@ from __future__ import with_statement
from . import base
import logging
from xml.etree import cElementTree as ET
-import traceback
import time
class xep_0050(base.base_plugin):
diff --git a/sleekxmpp/stanza/rootstanza.py b/sleekxmpp/stanza/rootstanza.py
index e568b62b..3bae1f0d 100644
--- a/sleekxmpp/stanza/rootstanza.py
+++ b/sleekxmpp/stanza/rootstanza.py
@@ -9,6 +9,7 @@ from .. xmlstream.stanzabase import StanzaBase
from xml.etree import cElementTree as ET
from . error import Error
from .. exceptions import XMPPError
+import logging
import traceback
import sys
@@ -29,6 +30,7 @@ class RootStanza(StanzaBase):
self['error']['text'] = "SleekXMPP got into trouble."
else:
self['error']['text'] = traceback.format_tb(e.__traceback__)
+ logging.exception('Error handling {%s}%s stanza' % (self.namespace, self.name))
self.send()
# all jabber:client root stanzas should have the error plugin
diff --git a/sleekxmpp/xmlstream/stanzabase.py b/sleekxmpp/xmlstream/stanzabase.py
index 8af90a0f..b8c80ffa 100644
--- a/sleekxmpp/xmlstream/stanzabase.py
+++ b/sleekxmpp/xmlstream/stanzabase.py
@@ -7,7 +7,6 @@
"""
from xml.etree import cElementTree as ET
import logging
-import traceback
import sys
import weakref
import copy
@@ -379,7 +378,7 @@ class StanzaBase(ElementBase):
pass
def exception(self, e):
- logging.error(traceback.format_tb(e))
+ logging.exception('Error handling {%s}%s stanza' % (self.namespace, self.name))
def send(self):
self.stream.sendRaw(self.__str__())
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py
index cea204b9..6ce89c25 100644
--- a/sleekxmpp/xmlstream/xmlstream.py
+++ b/sleekxmpp/xmlstream/xmlstream.py
@@ -19,7 +19,6 @@ import logging
import socket
import threading
import time
-import traceback
import types
import copy
import xml.sax.saxutils
@@ -195,14 +194,14 @@ class XMLStream(object):
return
else:
self.state.set('processing', False)
- traceback.print_exc()
+ logging.exception('Socket Error')
self.disconnect(reconnect=True)
except:
if not self.state.reconnect:
return
else:
self.state.set('processing', False)
- traceback.print_exc()
+ logging.exception('Connection error. Reconnecting.')
self.disconnect(reconnect=True)
if self.state['reconnect']:
self.reconnect()
@@ -258,8 +257,7 @@ class XMLStream(object):
logging.warning("Failed to send %s" % data)
self.state.set('connected', False)
if self.state.reconnect:
- logging.error("Disconnected. Socket Error.")
- traceback.print_exc()
+ logging.exception("Disconnected. Socket Error.")
self.disconnect(reconnect=True)
def sendRaw(self, data):
@@ -344,14 +342,14 @@ class XMLStream(object):
try:
handler.run(args[0])
except Exception as e:
- traceback.print_exc()
+ logging.exception('Error processing event handler: %s' % handler.name)
args[0].exception(e)
elif etype == 'schedule':
try:
logging.debug(args)
handler(*args[0])
except:
- logging.error(traceback.format_exc())
+ logging.exception('Error processing scheduled task')
elif etype == 'quit':
logging.debug("Quitting eventRunner thread")
return False