fluent-mixin-plaintextformatter 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/LICENSE.txt ADDED
@@ -0,0 +1,13 @@
1
+ Copyright (c) 2012- TAGOMORI Satoshi
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
data/README.md CHANGED
@@ -7,7 +7,7 @@ This module provides features to:
7
7
  * format whole data as serialized JSON, single attribute or separated multi attributes
8
8
  * include time as line header (formatted by time_format in UTC(default) or localtime), or not
9
9
  * include tag as line header (remove_prefix available), or not
10
- * change field separator (TAB(default), SPACE or COMMA)
10
+ * change field separator (TAB(default), SPACE, COMMA or SOH(\\001))
11
11
  * add new line as termination, or not
12
12
 
13
13
  ## Usage
@@ -72,7 +72,7 @@ Provided configurations are below:
72
72
  * output\_data\_type
73
73
  * 'json': output by JSON
74
74
  * 'attr:key1,key2,key3': values of 'key1' and 'key2' and ..., with separator specified by 'field_separator'
75
- * field\_separator [TAB/SPACE/COMMA]
75
+ * field\_separator [TAB/SPACE/COMMA/SOH]
76
76
  * add_newline [yes/no]
77
77
  * time_format
78
78
  * format string like '%Y-%m-%d %H:%M:%S' or you want
@@ -80,9 +80,12 @@ Provided configurations are below:
80
80
  * input tag 'test.foo' with 'remove_prefix test', output tag is 'foo'.
81
81
  * 'default\_tag' configuration is used when input tag is completely equal to 'remove\_prefix'
82
82
 
83
- ## AUTHORS
83
+ ## AUTHOR / CONTRIBUTORS
84
84
 
85
- * TAGOMORI Satoshi <tagomoris@gmail.com>
85
+ * AUTHOR
86
+ * TAGOMORI Satoshi <tagomoris@gmail.com>
87
+ * CONTRIBUTORS
88
+ * wolfg1969 https://github.com/wolfg1969
86
89
 
87
90
  ## LICENSE
88
91
 
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  Gem::Specification.new do |gem|
3
3
  gem.name = "fluent-mixin-plaintextformatter"
4
- gem.version = "0.1.0"
4
+ gem.version = "0.2.0"
5
5
  gem.authors = ["TAGOMORI Satoshi"]
6
6
  gem.email = ["tagomoris@gmail.com"]
7
7
  gem.description = %q{included to format values into json, tsv or csv}
@@ -25,6 +25,7 @@ module Fluent
25
25
  @f_separator = case @field_separator
26
26
  when /SPACE/i then ' '
27
27
  when /COMMA/i then ','
28
+ when /SOH/i then "\x01"
28
29
  else "\t"
29
30
  end
30
31
 
@@ -85,7 +85,27 @@ remove_prefix test
85
85
  # output_data_type json
86
86
  assert_equal r, JSON.parse(line.chomp.split(/ /, 3)[2])
87
87
  end
88
+ def test_separator_soh_remove_prefix
89
+ p = create_plugin_instance(Fluent::TestBOutput, %[
90
+ type testb
91
+ localtime
92
+ time_format %Y/%m/%d:%H:%M:%S
93
+ field_separator soh
94
+ remove_prefix test
95
+ ])
96
+ r = {'foo' => 'foo foo baz', 'bar' => 10000}
97
+ # stringify
98
+ assert_equal r, JSON.parse(p.stringify_record(r))
88
99
 
100
+ line = p.format('test.b', 1342163105, r)
101
+ # add_newline false
102
+ assert_equal line[0..-1], line.chomp
103
+ # output_include_time true, output_include_tag true, localtime, separator SOH
104
+ assert_equal ['2012/07/13:16:05:05', 'b'], line.chomp.split(/\001/, 3)[0..1]
105
+ # output_data_type json
106
+ assert_equal r, JSON.parse(line.chomp.split(/\001/, 3)[2])
107
+ end
108
+
89
109
  def test_default_without_time_tag
90
110
  p = create_plugin_instance(Fluent::TestCOutput, "type testc\n")
91
111
  r = {'foo' => 'foo foo baz', 'bar' => 10000}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-mixin-plaintextformatter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-13 00:00:00.000000000 Z
12
+ date: 2013-02-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fluentd
@@ -52,7 +52,7 @@ extra_rdoc_files: []
52
52
  files:
53
53
  - .gitignore
54
54
  - Gemfile
55
- - LICENSE
55
+ - LICENSE.txt
56
56
  - README.md
57
57
  - Rakefile
58
58
  - fluent-mixin-plaintextformatter.gemspec
data/LICENSE DELETED
@@ -1,22 +0,0 @@
1
- Copyright (c) 2012 TAGOMORI Satoshi
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.