jmoses_fluent-logger 0.4.8 → 0.4.9
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/fluent/logger/fluent_logger.rb +8 -5
- data/lib/fluent/logger/version.rb +1 -1
- data/spec/fluent_logger_spec.rb +3 -3
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.9
|
@@ -114,8 +114,7 @@ class FluentLogger < LoggerBase
|
|
114
114
|
|
115
115
|
def post_with_time(tag, map, time)
|
116
116
|
@logger.debug { "event: #{tag} #{map.to_json}" rescue nil }
|
117
|
-
|
118
|
-
write [tag, time.to_i, map]
|
117
|
+
write prepare_post_with_time_arguments(tag, map, time)
|
119
118
|
end
|
120
119
|
|
121
120
|
def batch_post_with_time(messages)
|
@@ -130,9 +129,7 @@ class FluentLogger < LoggerBase
|
|
130
129
|
# Reorder since #post_with_time takes a different order than #write
|
131
130
|
# NOTE Should we mangle the time? It should be .to_i here
|
132
131
|
payloads = messages.map do |msg|
|
133
|
-
|
134
|
-
proper[1] = proper[1].to_i unless proper[1].is_a?(Fixnum) # Convert time
|
135
|
-
prepare_msg proper
|
132
|
+
prepare_msg prepare_post_with_time_arguments(*msg)
|
136
133
|
end
|
137
134
|
|
138
135
|
# Check for 'false' payloads, those are errors, and last message will be set.
|
@@ -185,6 +182,12 @@ class FluentLogger < LoggerBase
|
|
185
182
|
end
|
186
183
|
end
|
187
184
|
|
185
|
+
def prepare_post_with_time_arguments(tag, map, time)
|
186
|
+
tag = "#{@tag_prefix}.#{tag}" if @tag_prefix
|
187
|
+
|
188
|
+
[tag, time.to_i, map]
|
189
|
+
end
|
190
|
+
|
188
191
|
def suppress_sec
|
189
192
|
if (sz = @connect_error_history.size) < RECONNECT_WAIT_MAX_COUNT
|
190
193
|
RECONNECT_WAIT * (RECONNECT_WAIT_INCR_RATE ** (sz - 1))
|
data/spec/fluent_logger_spec.rb
CHANGED
@@ -172,8 +172,8 @@ EOF
|
|
172
172
|
|
173
173
|
it ('batch post') {
|
174
174
|
messages = [
|
175
|
-
['
|
176
|
-
['
|
175
|
+
['tag1', 'message 1', Time.utc(2008, 9, 1, 10, 5, 0)],
|
176
|
+
['tag2', 'message 2', Time.utc(2008, 9, 1, 10, 6, 0)],
|
177
177
|
]
|
178
178
|
|
179
179
|
logger.batch_post_with_time(messages)
|
@@ -193,7 +193,7 @@ EOF
|
|
193
193
|
require 'digest/md5'
|
194
194
|
|
195
195
|
messages = 1000.times.map do |id|
|
196
|
-
['
|
196
|
+
['tag', Digest::MD5.hexdigest(id.to_s), Time.now]
|
197
197
|
end
|
198
198
|
|
199
199
|
single = Benchmark.realtime do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jmoses_fluent-logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-01-
|
13
|
+
date: 2014-01-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: yajl-ruby
|
@@ -190,7 +190,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
190
190
|
version: '0'
|
191
191
|
segments:
|
192
192
|
- 0
|
193
|
-
hash:
|
193
|
+
hash: 1803255651149495127
|
194
194
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
195
195
|
none: false
|
196
196
|
requirements:
|
@@ -199,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
199
199
|
version: '0'
|
200
200
|
segments:
|
201
201
|
- 0
|
202
|
-
hash:
|
202
|
+
hash: 1803255651149495127
|
203
203
|
requirements: []
|
204
204
|
rubyforge_project:
|
205
205
|
rubygems_version: 1.8.24
|