Skip to content

Commit

Permalink
Merge pull request #634 from fluent/fix-timeslicedoutput-emit
Browse files Browse the repository at this point in the history
Modify TimeSlicedOutput#emit mechanizm to fit BufferedOutput#emit way
  • Loading branch information
repeatedly committed Jul 20, 2015
2 parents 29261f2 + 8798b63 commit a7592fa
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/fluent/output.rb
Expand Up @@ -539,6 +539,7 @@ def configure(conf)

def emit(tag, es, chain)
@emit_count += 1
formatted_data = {}
es.each {|time,record|
tc = time / @time_slice_cache_interval
if @before_tc == tc
Expand All @@ -548,7 +549,10 @@ def emit(tag, es, chain)
key = @time_slicer.call(time)
@before_key = key
end
data = format(tag, time, record)
formatted_data[key] ||= ''
formatted_data[key] << format(tag, time, record)
}
formatted_data.each { |key, data|
if @buffer.emit(key, data, chain)
submit_flush
end
Expand Down

0 comments on commit a7592fa

Please sign in to comment.