lib/daemonizer/cli.rb in daemonizer-0.1.6 vs lib/daemonizer/cli.rb in daemonizer-0.2.0

- old
+ new

@@ -85,11 +85,11 @@ end desc "debug", "Debug pool (do not demonize)" def debug(pool_name = nil) puts "You should supply pool_name to debug" if pool_name.nil? - control_pools_loop(pool_name, "execution ended") do |pool| + control_pools_loop(pool_name, "execution ended", true) do |pool| STDOUT.sync = true print_pool pool.name, "Debugging pool: " engine = Engine.new(pool) engine.debug! @@ -99,12 +99,17 @@ end return true end private - def control_pools_loop(pool_name, message = nil, &block) + def control_pools_loop(pool_name, message = nil, debug = false, &block) Daemonizer.find_pools(pool_name).each do |pool| Process.fork do + if debug + Daemonizer.init_console_logger(pool.name.to_s) + else + Daemonizer.init_logger(pool.name.to_s, pool.log_file) + end yield(pool) end Process.wait if $?.exitstatus == 0 and message print_pool pool.name, message