From 80d323c39218d113d3002f5bf76bd464cddfcb95 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sat, 1 Jun 2013 14:53:51 -0500 Subject: Guard logging operation to prevent needless text join Signed-off-by: Dan McGee --- mirrors/management/commands/mirrorcheck.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mirrors/management/commands/mirrorcheck.py b/mirrors/management/commands/mirrorcheck.py index 6faf294a..3f026c36 100644 --- a/mirrors/management/commands/mirrorcheck.py +++ b/mirrors/management/commands/mirrorcheck.py @@ -179,10 +179,11 @@ def check_rsync_url(mirror_url, location, timeout): rsync_cmd.append(lastsync_path) try: with open(os.devnull, 'w') as devnull: - logger.debug("rsync cmd: %s", ' '.join(rsync_cmd)) + if logger.isEnabledFor(logging.DEBUG): + logger.debug("rsync cmd: %s", ' '.join(rsync_cmd)) + start = time.time() proc = subprocess.Popen(rsync_cmd, stdout=devnull, stderr=subprocess.PIPE) - start = time.time() _, errdata = proc.communicate() end = time.time() log.duration = end - start -- cgit v1.2.3-55-g3dc8