l2meter 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/l2meter/emitter.rb +11 -17
- data/lib/l2meter/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8758c9423aad4f0d392487036c92d4501e6a8fc
|
4
|
+
data.tar.gz: 14250d1270dabf5f366ee22c7bbab6dff0e8abcf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed94d0f0a82ec17c59e4b57a0598adaac7f0eb6bd2d4662e42bd9ec785a3f563cf56b1ee582bc5fb104b2f676f1ebd161aed76f45ce8c8d37823a8d895a5099b
|
7
|
+
data.tar.gz: c53adc609873409a3a9f5edaf3acce2d6732cc811f347a16764ea3a41cee55b01f96cd2567e6a9b2d1597a64c04e3697c701d4bbb5e0d480b06e4cce59cd0936
|
data/lib/l2meter/emitter.rb
CHANGED
@@ -80,15 +80,19 @@ module L2meter
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def batch
|
83
|
+
autoflush = @autoflush
|
83
84
|
@autoflush = false
|
84
85
|
yield
|
85
86
|
ensure
|
86
|
-
@autoflush =
|
87
|
-
|
87
|
+
@autoflush = autoflush
|
88
|
+
write
|
88
89
|
end
|
89
90
|
|
90
91
|
def merge!(*args)
|
91
|
-
|
92
|
+
unwrap(args).each do |key, value|
|
93
|
+
key = configuration.key_formatter.call(key)
|
94
|
+
@buffer[key] = value
|
95
|
+
end
|
92
96
|
end
|
93
97
|
|
94
98
|
def fire!
|
@@ -124,7 +128,6 @@ module L2meter
|
|
124
128
|
|
125
129
|
def build_token(key, value)
|
126
130
|
value = value.call if Proc === value
|
127
|
-
return if value.nil?
|
128
131
|
value = scrub_value(key, value)
|
129
132
|
return if value.nil?
|
130
133
|
value == true ? key : "#{key}=#{format_value(value)}"
|
@@ -149,28 +152,19 @@ module L2meter
|
|
149
152
|
|
150
153
|
def format_value(value)
|
151
154
|
case value
|
152
|
-
when /[^\w,.:@\-\]\[]/
|
153
|
-
value.strip.gsub(/\s+/, " ").inspect
|
154
|
-
when String
|
155
|
-
value.to_s
|
156
155
|
when Float
|
157
156
|
format_float(value)
|
158
157
|
when Time
|
159
158
|
value.iso8601
|
160
|
-
when Hash
|
161
|
-
format_value(value.inspect)
|
162
159
|
when Array
|
163
160
|
value.map(&method(:format_value)).join(?,)
|
164
161
|
else
|
165
|
-
|
162
|
+
format_string_value(value.to_s)
|
166
163
|
end
|
167
164
|
end
|
168
165
|
|
169
|
-
def
|
170
|
-
|
171
|
-
key = configuration.key_formatter.call(key)
|
172
|
-
acc[key] = value
|
173
|
-
end
|
166
|
+
def format_string_value(value)
|
167
|
+
value =~ /[^\w,.:@\-\]\[]/ ? value.strip.gsub(/\s+/, " ").inspect : value.to_s
|
174
168
|
end
|
175
169
|
|
176
170
|
def write(params = nil)
|
@@ -223,7 +217,7 @@ module L2meter
|
|
223
217
|
end
|
224
218
|
|
225
219
|
def scrub_value(key, value)
|
226
|
-
if scrubber = configuration.scrubber
|
220
|
+
if !value.nil? && scrubber = configuration.scrubber
|
227
221
|
scrubber.call(key, value)
|
228
222
|
else
|
229
223
|
value
|
data/lib/l2meter/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: l2meter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Pravosud
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -45,7 +45,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
45
45
|
version: '0'
|
46
46
|
requirements: []
|
47
47
|
rubyforge_project:
|
48
|
-
rubygems_version: 2.6.
|
48
|
+
rubygems_version: 2.6.12
|
49
49
|
signing_key:
|
50
50
|
specification_version: 4
|
51
51
|
summary: L2met friendly log formatter
|