Skip to content

Commit dfbd5ef

Browse files
authored
Merge pull request #50 from fluent-plugins-nursery/yajl-to-json
Replace yajl-ruby with the json gem for JSON handling
2 parents f219198 + b492565 commit dfbd5ef

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ CREATE TABLE fluentd (
6868
#tag_col tag
6969
#record_col record
7070
#msgpack false
71-
#encoder yajl
71+
#encoder json
7272
</match>
7373
```
7474

@@ -87,7 +87,7 @@ CREATE TABLE fluentd (
8787
|tag_col|The column name for the tag|`tag`|
8888
|record_col|The column name for the record|`record`|
8989
|msgpack|If true, insert records formatted as msgpack|`false`|
90-
|encoder|JSON encoder (`yajl`, `json`)|`yajl`|
90+
|encoder|JSON encoder (`yajl`, `json`) Starting from v1.0.3, `yajl` is no longer available and internally defaults to `json`|`json`|
9191

9292
## Copyright
9393

lib/fluent/plugin/out_pgjson.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
require "fluent/plugin/output"
22
require "pg"
3-
require "yajl"
43
require "json"
54

65
module Fluent::Plugin
@@ -34,7 +33,7 @@ class PgJsonOutput < Fluent::Plugin::Output
3433
desc "If true, insert records formatted as msgpack"
3534
config_param :msgpack, :bool, default: false
3635
desc "JSON encoder (yajl/json)"
37-
config_param :encoder, :enum, list: [:yajl, :json], default: :yajl
36+
config_param :encoder, :enum, list: [:yajl, :json], default: :json # NOTE: Contains yajl for backward compatibility
3837

3938
config_param :time_format, :string, default: "%F %T.%N %z"
4039

@@ -56,7 +55,8 @@ def configure(conf)
5655
end
5756
@encoder = case @encoder
5857
when :yajl
59-
Yajl
58+
log.info "encoder 'yajl' is deprecated. Please use 'json' instead."
59+
JSON
6060
when :json
6161
JSON
6262
end

test/plugin/test_out.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class PgJsonOutputTest < Test::Unit::TestCase
1717
TIME_COL = "time"
1818
TAG_COL = "tag"
1919
RECORD_COL = "record"
20-
ENCODER = Yajl
20+
ENCODER = JSON
2121

2222
CONFIG = %[
2323
@type pgjson

0 commit comments

Comments
 (0)