diff --git a/Gemfile.lock b/Gemfile.lock index 5492aa4..a92a166 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - rabbit_carrots (1.0.3) + rabbit_carrots (1.0.4) bunny (>= 2.22) connection_pool (~> 2.4) diff --git a/lib/puma/plugin/rabbit_carrots.rb b/lib/puma/plugin/rabbit_carrots.rb index e4301ea..3344c16 100644 --- a/lib/puma/plugin/rabbit_carrots.rb +++ b/lib/puma/plugin/rabbit_carrots.rb @@ -1,5 +1,4 @@ # rabbit_carrots.rb - require 'puma/plugin' require 'rabbit_carrots' @@ -8,7 +7,7 @@ Puma::Plugin.create do def start(launcher) @log_writer = launcher.log_writer - @puma_pid = $PROCESS_ID + @puma_pid = $$ @core_service = RabbitCarrots::Core.new(logger: log_writer) @@ -58,7 +57,7 @@ Puma::Plugin.create do loop do if send(process_dead) log message - Process.kill('TERM', $PROCESS_ID) + Process.kill('TERM', $$) break end sleep 2 diff --git a/lib/rabbit_carrots/core.rb b/lib/rabbit_carrots/core.rb index 4297092..c77f286 100644 --- a/lib/rabbit_carrots/core.rb +++ b/lib/rabbit_carrots/core.rb @@ -125,12 +125,15 @@ module RabbitCarrots def adapter.info(msg) @logger.write("[INFO] #{msg}\n") end + def adapter.error(msg) @logger.write("[ERROR] #{msg}\n") end + def adapter.warn(msg) @logger.write("[WARN] #{msg}\n") end + adapter.instance_variable_set(:@logger, logger) adapter end diff --git a/lib/rabbit_carrots/version.rb b/lib/rabbit_carrots/version.rb index 55c2024..a05e114 100644 --- a/lib/rabbit_carrots/version.rb +++ b/lib/rabbit_carrots/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module RabbitCarrots - VERSION = '1.0.3' + VERSION = '1.0.4' end