Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/fluent/plugin/formatter_json.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ def configure(conf)
if Fluent::OjOptions.available?
@dump_proc = Oj.method(:dump)
else
log.info "Oj isn't installed, fallback to Yajl as json parser"
@dump_proc = Yajl.method(:dump)
log.info "Oj isn't installed, fallback to JSON as json parser"
@dump_proc = JSON.method(:generate)
end
else
@dump_proc = Yajl.method(:dump)
@dump_proc = JSON.method(:generate)
end

# format json is used on various highload environment, so re-define method to skip if check
Expand Down
2 changes: 1 addition & 1 deletion test/plugin/test_out_stdout.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def create_driver(conf = CONFIG)

if data == 'yajl'
# NOTE: Float::NAN is not jsonable
assert_raise(Yajl::EncodeError) { d.feed('test', time, {'test' => Float::NAN}) }
assert_raise(JSON::GeneratorError) { d.feed('test', time, {'test' => Float::NAN}) }
else
out = capture_log { d.feed('test', time, {'test' => Float::NAN}) }
assert_equal "#{Time.at(time).localtime.strftime(TIME_FORMAT)} test: {\"test\":NaN}\n", out
Expand Down
Loading