summaryrefslogtreecommitdiff
path: root/redis/client.py
diff options
context:
space:
mode:
authorWill Maier <willmaier@ml1.net>2011-01-06 10:27:04 -0600
committerWill Maier <willmaier@ml1.net>2011-01-06 10:27:04 -0600
commitdb74ce9aa9ca7ffae9eb93b2037c4311805d3132 (patch)
treea137515c2903cfc50802a42dca5fc9c6fe069fbd /redis/client.py
parentf1285cc2db1957df4adc40fb865088a87f0eafdc (diff)
downloadredis-py-db74ce9aa9ca7ffae9eb93b2037c4311805d3132.tar.gz
add logging boilerplate
Diffstat (limited to 'redis/client.py')
-rw-r--r--redis/client.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/redis/client.py b/redis/client.py
index 967bcee..c473444 100644
--- a/redis/client.py
+++ b/redis/client.py
@@ -1,5 +1,6 @@
import datetime
import errno
+import logging
import socket
import threading
import time
@@ -8,6 +9,16 @@ from itertools import chain, imap
from redis.exceptions import ConnectionError, ResponseError, InvalidResponse, WatchError
from redis.exceptions import RedisError, AuthenticationError
+try:
+ NullHandler = logging.NullHandler
+except AttributeError:
+ class NullHandler(logging.Handler):
+ def emit(self, record): pass
+
+log = logging.getLogger("redis")
+# Add a no-op handler to avoid error messages if the importing module doesn't
+# configure logging.
+log.addHandler(NullHandler())
class ConnectionPool(threading.local):
"Manages a list of connections on the local thread"