From 682d4adb4076d0fca581c5152f532691f27abf6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toms=20Bau=C4=A3is?= Date: Mon, 31 Aug 2015 15:15:08 +0100 Subject: [PATCH 1/3] log result in DEBUG level and truncate to 2k symbols --- rq/worker.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/rq/worker.py b/rq/worker.py index c1c5d8e..ff70983 100644 --- a/rq/worker.py +++ b/rq/worker.py @@ -599,10 +599,12 @@ class Worker(object): self.handle_exception(job, *sys.exc_info()) return False - if rv is None: - self.log.info('Job OK') - else: - self.log.info('Job OK, result = {0!r}'.format(yellow(text_type(rv)))) + self.log.info(green('Job OK')) + if rv: + log_result = "{0!r}".format(text_type(rv)) + if len(log_result) > 2000: + log_result = "{}..\n..output truncated".format(log_result[:2000]) + self.log.debug('Result: {}'.format(yellow(log_result))) if result_ttl == 0: self.log.info('Result discarded immediately') From ade154575e1b93e357970010d9223b3c90678515 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toms=20Bau=C4=A3is?= Date: Tue, 1 Sep 2015 13:27:17 +0100 Subject: [PATCH 2/3] fix travis error - python 2.6 or whatevs wants positions spelled out for .format --- rq/worker.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rq/worker.py b/rq/worker.py index ff70983..1f592a1 100644 --- a/rq/worker.py +++ b/rq/worker.py @@ -603,8 +603,8 @@ class Worker(object): if rv: log_result = "{0!r}".format(text_type(rv)) if len(log_result) > 2000: - log_result = "{}..\n..output truncated".format(log_result[:2000]) - self.log.debug('Result: {}'.format(yellow(log_result))) + log_result = "{0}..\n..output truncated".format(log_result[:2000]) + self.log.debug('Result: {0}'.format(yellow(log_result))) if result_ttl == 0: self.log.info('Result discarded immediately') From 5a4f297134a78a1fd8fec9c79c94202efc402089 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toms=20Bau=C4=A3is?= Date: Tue, 22 Sep 2015 14:23:12 +0100 Subject: [PATCH 3/3] do not truncate result output as that can be done in the log formatter --- rq/worker.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/rq/worker.py b/rq/worker.py index 1f592a1..231b219 100644 --- a/rq/worker.py +++ b/rq/worker.py @@ -602,8 +602,6 @@ class Worker(object): self.log.info(green('Job OK')) if rv: log_result = "{0!r}".format(text_type(rv)) - if len(log_result) > 2000: - log_result = "{0}..\n..output truncated".format(log_result[:2000]) self.log.debug('Result: {0}'.format(yellow(log_result))) if result_ttl == 0: