diff options
author | Lance Stout <lancestout@gmail.com> | 2010-11-06 01:28:59 -0400 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2010-11-06 01:28:59 -0400 |
commit | 4fb77ac8787422169566d613562127acf75a427b (patch) | |
tree | c0c0f095c7c7cd2f701c85462e768b214657e072 /sleekxmpp/plugins/xep_0199.py | |
parent | d0c506f93010f62cd447ce29f98ab991f521ec99 (diff) | |
download | slixmpp-4fb77ac8787422169566d613562127acf75a427b.tar.gz slixmpp-4fb77ac8787422169566d613562127acf75a427b.tar.bz2 slixmpp-4fb77ac8787422169566d613562127acf75a427b.tar.xz slixmpp-4fb77ac8787422169566d613562127acf75a427b.zip |
Logging no longer uses root logger.
Each module should now log into its own logger.
Diffstat (limited to 'sleekxmpp/plugins/xep_0199.py')
-rw-r--r-- | sleekxmpp/plugins/xep_0199.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sleekxmpp/plugins/xep_0199.py b/sleekxmpp/plugins/xep_0199.py index 1be326cb..20055945 100644 --- a/sleekxmpp/plugins/xep_0199.py +++ b/sleekxmpp/plugins/xep_0199.py @@ -2,7 +2,7 @@ SleekXMPP: The Sleek XMPP Library Copyright (C) 2010 Nathanael C. Fritz This file is part of SleekXMPP. - + See the file LICENSE for copying permission. """ from xml.etree import cElementTree as ET @@ -10,6 +10,10 @@ from . import base import time import logging + +log = logging.getLogger(__name__) + + class xep_0199(base.base_plugin): """XEP-0199 XMPP Ping""" @@ -20,19 +24,19 @@ class xep_0199(base.base_plugin): self.running = False if self.config.get('keepalive', True): self.xmpp.add_event_handler('session_start', self.handler_pingserver, threaded=True) - + def post_init(self): base.base_plugin.post_init(self) self.xmpp.plugin['xep_0030'].add_feature('urn:xmpp:ping') - + def handler_pingserver(self, xml): if not self.running: time.sleep(self.config.get('frequency', 300)) while self.sendPing(self.xmpp.server, self.config.get('timeout', 30)) is not False: time.sleep(self.config.get('frequency', 300)) - logging.debug("Did not recieve ping back in time. Requesting Reconnect.") + log.debug("Did not recieve ping back in time. Requesting Reconnect.") self.xmpp.disconnect(reconnect=True) - + def handler_ping(self, xml): iq = self.xmpp.makeIqResult(xml.get('id', 'unknown')) iq.attrib['to'] = xml.get('from', self.xmpp.boundjid.domain) |