class Fluent::Agent

def flush_recursive(array)

def flush_recursive(array)
  array.each { |o|
    begin
      if o.is_a?(BufferedOutput)
        o.force_flush
      elsif o.is_a?(MultiOutput)
        flush_recursive(o.outputs)
      end
    rescue => e
      log.debug "error while force flushing", error_class: e.class, error: e
      log.debug_backtrace
    end
  }
end