summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Maier <willmaier@ml1.net>2011-01-07 14:26:47 -0600
committerWill Maier <willmaier@ml1.net>2011-01-07 14:26:47 -0600
commitc098f3214cca90f41456aee836257dc356ac709c (patch)
treec84c28b558861376d03ff7e9a8953166f0d02247
parent40ca9c27c2136bd0b4c85fa5fb012b3cd87e974a (diff)
downloadredis-py-c098f3214cca90f41456aee836257dc356ac709c.tar.gz
shield logging with isEnabledFor.
-rw-r--r--redis/client.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/redis/client.py b/redis/client.py
index b02716e..81e977c 100644
--- a/redis/client.py
+++ b/redis/client.py
@@ -1438,10 +1438,11 @@ class Pipeline(Redis):
commands,
(('', ('EXEC',), ''),)
)])
- log.debug("MULTI")
- for command in commands:
- log.debug("TRANSACTION> "+ repr_command(command[1]))
- log.debug("EXEC")
+ if log.isEnabledFor(logging.DEBUG):
+ log.debug("MULTI")
+ for command in commands:
+ log.debug("TRANSACTION> "+ repr_command(command[1]))
+ log.debug("EXEC")
self.connection.send(all_cmds, self)
# parse off the response for MULTI and all commands prior to EXEC
for i in range(len(commands)+1):
@@ -1467,8 +1468,9 @@ class Pipeline(Redis):
def _execute_pipeline(self, commands):
# build up all commands into a single request to increase network perf
all_cmds = ''.join([self._encode_command(c) for _1, c, _2 in commands])
- for command in commands:
- log.debug("PIPELINE> " + repr_command(command[1]))
+ if log.isEnabledFor(logging.DEBUG):
+ for command in commands:
+ log.debug("PIPELINE> " + repr_command(command[1]))
self.connection.send(all_cmds, self)
data = []
for command_name, _, options in commands: