Class: Fluent::Plugin::TailInput::TailWatcher::LineBufferTimerFlusher
- Inherits:
-
Object
- Object
- Fluent::Plugin::TailInput::TailWatcher::LineBufferTimerFlusher
- Defined in:
- lib/fluent/plugin/in_tail.rb
Instance Attribute Summary collapse
-
#line_buffer ⇒ Object
Returns the value of attribute line_buffer.
Instance Method Summary collapse
- #close(tw) ⇒ Object
-
#initialize(log, flush_interval, &flush_method) ⇒ LineBufferTimerFlusher
constructor
A new instance of LineBufferTimerFlusher.
- #on_notify(tw) ⇒ Object
- #reset_timer ⇒ Object
Constructor Details
#initialize(log, flush_interval, &flush_method) ⇒ LineBufferTimerFlusher
Returns a new instance of LineBufferTimerFlusher.
1213 1214 1215 1216 1217 1218 1219 |
# File 'lib/fluent/plugin/in_tail.rb', line 1213 def initialize(log, flush_interval, &flush_method) @log = log @flush_interval = flush_interval @flush_method = flush_method @start = nil @line_buffer = nil end |
Instance Attribute Details
#line_buffer ⇒ Object
Returns the value of attribute line_buffer.
1211 1212 1213 |
# File 'lib/fluent/plugin/in_tail.rb', line 1211 def line_buffer @line_buffer end |
Instance Method Details
#close(tw) ⇒ Object
1233 1234 1235 1236 1237 1238 |
# File 'lib/fluent/plugin/in_tail.rb', line 1233 def close(tw) return unless @line_buffer @flush_method.call(tw, @line_buffer) @line_buffer = nil end |
#on_notify(tw) ⇒ Object
1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 |
# File 'lib/fluent/plugin/in_tail.rb', line 1221 def on_notify(tw) unless @start && @flush_method return end if Time.now - @start >= @flush_interval @flush_method.call(tw, @line_buffer) if @line_buffer @line_buffer = nil @start = nil end end |
#reset_timer ⇒ Object
1240 1241 1242 1243 1244 |
# File 'lib/fluent/plugin/in_tail.rb', line 1240 def reset_timer return unless @flush_interval @start = Time.now end |