diff options
author | Will Maier <willmaier@ml1.net> | 2011-01-06 10:27:04 -0600 |
---|---|---|
committer | Will Maier <willmaier@ml1.net> | 2011-01-06 10:27:04 -0600 |
commit | db74ce9aa9ca7ffae9eb93b2037c4311805d3132 (patch) | |
tree | a137515c2903cfc50802a42dca5fc9c6fe069fbd /redis/client.py | |
parent | f1285cc2db1957df4adc40fb865088a87f0eafdc (diff) | |
download | redis-py-db74ce9aa9ca7ffae9eb93b2037c4311805d3132.tar.gz |
add logging boilerplate
Diffstat (limited to 'redis/client.py')
-rw-r--r-- | redis/client.py | 11 |
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" |