Class: Fluent::Plugin::FileServiceDiscovery::StatWatcher

Inherits:
Coolio::StatWatcher
  • Object
show all
Defined in:
lib/fluent/plugin/sd_file.rb

Instance Method Summary collapse

Constructor Details

#initialize(path, log, &callback) ⇒ StatWatcher

Returns a new instance of StatWatcher.



141
142
143
144
145
146
# File 'lib/fluent/plugin/sd_file.rb', line 141

def initialize(path, log, &callback)
  @path = path
  @log = log
  @callback = callback
  super(@path)
end

Instance Method Details

#on_change(prev_stat, cur_stat) ⇒ Object



148
149
150
151
152
# File 'lib/fluent/plugin/sd_file.rb', line 148

def on_change(prev_stat, cur_stat)
  @callback.call(prev_stat, cur_stat)
rescue => e
  @log.error(e)
end