Module: Fluent::DetachProcessMixin

Includes:
DetachProcessImpl
Defined in:
lib/fluent/process.rb

Instance Method Summary collapse

Methods included from DetachProcessImpl

#on_detach_process, #on_exit_process

Instance Method Details

#configure(conf) ⇒ Object



422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
# File 'lib/fluent/process.rb', line 422

def configure(conf)
  super

  @detach_process = nil

  if detach_process = conf['detach_process']
    b3v = Config.bool_value(detach_process)
    case b3v
    when nil
      num = detach_process.to_i
      if num > 1
        $log.warn "'detach_process' parameter supports only 1 process on this plugin: #{conf}"
      elsif num > 0
        @detach_process = true
      elsif detach_process =~ /0+/
        @detach_process = false
      else
        @detach_process = true
      end
    when true
      @detach_process = true
    when false
      @detach_process = false
    end
  end
end

#detach_process(&block) ⇒ Object



449
450
451
452
453
454
455
# File 'lib/fluent/process.rb', line 449

def detach_process(&block)
  if @detach_process
    detach_process_impl(1, &block)
  else
    block.call
  end
end