lib/fluent/plugin/in_status.rb in fluentd-0.10.42 vs lib/fluent/plugin/in_status.rb in fluentd-0.10.43
- old
+ new
@@ -25,31 +25,32 @@
config_param :emit_interval, :time, :default => 60
config_param :tag, :string
class TimerWatcher < Coolio::TimerWatcher
- def initialize(interval, repeat, &callback)
+ def initialize(interval, repeat, log, &callback)
@callback = callback
+ @log = log
super(interval, repeat)
end
def on_timer
@callback.call
rescue
# TODO log?
- $log.error $!.to_s
- $log.error_backtrace
+ @log.error $!.to_s
+ @log.error_backtrace
end
end
def configure(conf)
super
end
def start
@loop = Coolio::Loop.new
- @timer = TimerWatcher.new(@emit_interval, true, &method(:on_timer))
+ @timer = TimerWatcher.new(@emit_interval, true, log, &method(:on_timer))
@loop.attach(@timer)
@thread = Thread.new(&method(:run))
end
def shutdown
@@ -59,11 +60,11 @@
end
def run
@loop.run
rescue
- $log.error "unexpected error", :error=>$!.to_s
- $log.error_backtrace
+ log.error "unexpected error", :error=>$!.to_s
+ log.error_backtrace
end
def on_timer
now = Engine.now
Status.each {|record|