class Fluent::Plugin::BareOutput

def emit_sync(tag, es)

def emit_sync(tag, es)
  @counters_monitor.synchronize{ @emit_count += 1 }
  begin
    process(tag, es)
    @counters_monitor.synchronize{ @emit_records += es.size }
  rescue
    @counters_monitor.synchronize{ @num_errors += 1 }
    raise
  end
end

def initialize

def initialize
  super
  @counters_monitor = Monitor.new
  # TODO: well organized counters
  @num_errors = 0
  @emit_count = 0
  @emit_records = 0
end

def process(tag, es)

def process(tag, es)
  raise NotImplementedError, "BUG: output plugins MUST implement this method"
end