Class: Fluent::TailExAsisInput::TailExAsisWatcher
- Inherits:
-
TailWatcher
- Object
- TailWatcher
- Fluent::TailExAsisInput::TailExAsisWatcher
- Defined in:
- lib/fluent/plugin/in_tail_ex_asis.rb
Instance Method Summary collapse
- #_close ⇒ Object
- #_receive_lines(lines) ⇒ Object
- #close(loop = nil) ⇒ Object
-
#initialize(path, rotate_wait, pe, &receive_lines) ⇒ TailExAsisWatcher
constructor
A new instance of TailExAsisWatcher.
Constructor Details
#initialize(path, rotate_wait, pe, &receive_lines) ⇒ TailExAsisWatcher
Returns a new instance of TailExAsisWatcher.
120 121 122 123 124 |
# File 'lib/fluent/plugin/in_tail_ex_asis.rb', line 120 def initialize(path, rotate_wait, pe, &receive_lines) @parent_receive_lines = receive_lines super(path, rotate_wait, pe, &method(:_receive_lines)) @close_trigger = TimerWatcher.new(rotate_wait * 2, false, &method(:_close)) end |
Instance Method Details
#_close ⇒ Object
140 141 142 143 144 145 146 147 |
# File 'lib/fluent/plugin/in_tail_ex_asis.rb', line 140 def _close @close_trigger.detach if @close_trigger.attached? self.class.superclass.instance_method(:close).bind(self).call @io_handler.on_notify @io_handler.close $log.info "stop following of #{@path}" end |
#_receive_lines(lines) ⇒ Object
126 127 128 129 |
# File 'lib/fluent/plugin/in_tail_ex_asis.rb', line 126 def _receive_lines(lines) tag = @path.tr('/', '.').gsub(/\.+/, '.').gsub(/^\./, '') @parent_receive_lines.call(lines, tag) end |
#close(loop = nil) ⇒ Object
131 132 133 134 135 136 137 138 |
# File 'lib/fluent/plugin/in_tail_ex_asis.rb', line 131 def close(loop=nil) detach # detach first to avoid timer conflict if loop @close_trigger.attach(loop) else _close end end |