Skip to content

Commit

Permalink
Use get_log
Browse files Browse the repository at this point in the history
  • Loading branch information
invisibleroads committed Jun 21, 2017
1 parent 9e9e66c commit 82756be
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 18 deletions.
7 changes: 5 additions & 2 deletions socketIO_client/heartbeats.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import logging
from invisibleroads_macros.log import get_log
from threading import Thread, Event

from .exceptions import ConnectionError, TimeoutError


L = get_log(__name__)


class HeartbeatThread(Thread):

daemon = True
Expand Down Expand Up @@ -33,7 +36,7 @@ def run(self):
interval_in_seconds = self._relax_interval_in_seconds
self._rest.wait(interval_in_seconds)
except ConnectionError:
logging.debug('[heartbeat connection error]')
L.debug('[heartbeat connection error]')

def relax(self):
self._adrenaline.clear()
Expand Down
8 changes: 3 additions & 5 deletions socketIO_client/logs.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import logging
import time
from invisibleroads_macros.log import get_log

from .symmetries import NullHandler


LOG = logging.getLogger('socketIO-client')
LOG.addHandler(NullHandler())
L = get_log('socketIO-client')


class LoggingMixin(object):

def _log(self, level, msg, *attrs):
LOG.log(level, '%s %s' % (self._log_name, msg), *attrs)
L.log(level, '%s %s' % (self._log_name, msg), *attrs)

def _debug(self, msg, *attrs):
self._log(logging.DEBUG, msg, *attrs)
Expand Down
11 changes: 0 additions & 11 deletions socketIO_client/symmetries.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
try:
from logging import NullHandler
except ImportError: # Python 2.6
from logging import Handler

class NullHandler(Handler):

def emit(self, record):
pass


from six import indexbytes


Expand Down

0 comments on commit 82756be

Please sign in to comment.