From 8d46bdee16e48bd1a1a8659220293bc26e6d1d44 Mon Sep 17 00:00:00 2001 From: Christian Bruckmayer Date: Thu, 5 Sep 2024 13:27:02 +0100 Subject: [PATCH] Log before and after commands are issued --- ruby/lib/ci/queue/redis/base.rb | 10 ++++++---- ruby/test/integration/minitest_redis_test.rb | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ruby/lib/ci/queue/redis/base.rb b/ruby/lib/ci/queue/redis/base.rb index e401cce4..8cdb2791 100644 --- a/ruby/lib/ci/queue/redis/base.rb +++ b/ruby/lib/ci/queue/redis/base.rb @@ -13,16 +13,18 @@ class Base module RedisInstrumentation def call(command, redis_config) - result = super logger = redis_config.custom[:debug_log] - logger.info("#{command}: #{result}") + logger.info("Running '#{command}'") + result = super + logger.info("Finished '#{command}': #{result}") result end def call_pipelined(commands, redis_config) - result = super logger = redis_config.custom[:debug_log] - logger.info("#{commands}: #{result}") + logger.info("Running '#{commands}'") + result = super + logger.info("Finished '#{commands}': #{result}") result end end diff --git a/ruby/test/integration/minitest_redis_test.rb b/ruby/test/integration/minitest_redis_test.rb index 132b983a..05e426ef 100644 --- a/ruby/test/integration/minitest_redis_test.rb +++ b/ruby/test/integration/minitest_redis_test.rb @@ -138,7 +138,7 @@ def test_debug_log ) end - assert_includes File.read(log_file.path), 'INFO -- : ["exists", "build:1:worker:1:queue"]: 0' + assert_includes File.read(log_file.path), 'INFO -- : Finished \'["exists", "build:1:worker:1:queue"]\': 0' assert_empty err result = normalize(out.lines.last.strip) assert_equal '--- Ran 11 tests, 8 assertions, 2 failures, 1 errors, 1 skips, 4 requeues in X.XXs', result