lograge 0.9.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/lograge/formatters/key_value.rb +15 -13
- data/lib/lograge/formatters/l2met.rb +15 -4
- data/lib/lograge/log_subscriber.rb +5 -1
- data/lib/lograge/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 90e32e509e2b788089246d22c8755d69d495d54f807a8e52e3e0fee3406a448c
|
4
|
+
data.tar.gz: 1f969f77c0d5b3878e8a090be723888ba037f982d9688b12ace2f672ce450d9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b253f8a2a86557ed264df935b94379f61ef90c426d83d901672c4deef286e40a934c9e596f23ddf22195d8549207ce213ea67a35a039008ace6202c0b131f29b
|
7
|
+
data.tar.gz: 0112025bfd732a2b41a52c8325e5cc090b94c2056f2d819d8afe9491f063d01c7be3950e25a2707de4955d15b5d8ca59368eab5236ef634f9ceb1c3ac301dafe
|
@@ -2,27 +2,29 @@ module Lograge
|
|
2
2
|
module Formatters
|
3
3
|
class KeyValue
|
4
4
|
def call(data)
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
event.join(' ')
|
5
|
+
fields_to_display(data)
|
6
|
+
.map { |key| format(key, data[key]) }
|
7
|
+
.join(' ')
|
9
8
|
end
|
10
9
|
|
10
|
+
protected
|
11
|
+
|
11
12
|
def fields_to_display(data)
|
12
13
|
data.keys
|
13
14
|
end
|
14
15
|
|
15
16
|
def format(key, value)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
17
|
+
"#{key}=#{parse_value(key, value)}"
|
18
|
+
end
|
19
|
+
|
20
|
+
def parse_value(key, value)
|
21
|
+
# Exactly preserve the previous output
|
22
|
+
# Parsing this can be ambigious if the error messages contains
|
23
|
+
# a single quote
|
24
|
+
return "'#{value}'" if key == :error
|
25
|
+
return Kernel.format('%.2f', value) if value.is_a? Float
|
24
26
|
|
25
|
-
|
27
|
+
value
|
26
28
|
end
|
27
29
|
end
|
28
30
|
end
|
@@ -16,20 +16,31 @@ module Lograge
|
|
16
16
|
:location
|
17
17
|
].freeze
|
18
18
|
|
19
|
+
UNWANTED_FIELDS = [
|
20
|
+
:controller,
|
21
|
+
:action
|
22
|
+
].freeze
|
23
|
+
|
19
24
|
def call(data)
|
20
25
|
super(modify_payload(data))
|
21
26
|
end
|
22
27
|
|
28
|
+
protected
|
29
|
+
|
30
|
+
def fields_to_display(data)
|
31
|
+
L2MET_FIELDS + additional_fields(data)
|
32
|
+
end
|
33
|
+
|
34
|
+
def additional_fields(data)
|
35
|
+
(data.keys - L2MET_FIELDS) - UNWANTED_FIELDS
|
36
|
+
end
|
37
|
+
|
23
38
|
def format(key, value)
|
24
39
|
key = "measure#page.#{key}" if value.is_a?(Float)
|
25
40
|
|
26
41
|
super(key, value)
|
27
42
|
end
|
28
43
|
|
29
|
-
def fields_to_display(data)
|
30
|
-
L2MET_FIELDS + (data.keys - L2MET_FIELDS) - [:controller, :action]
|
31
|
-
end
|
32
|
-
|
33
44
|
def modify_payload(data)
|
34
45
|
data[:source] = source_field(data) if data[:controller] && data[:action]
|
35
46
|
|
@@ -53,6 +53,10 @@ module Lograge
|
|
53
53
|
|
54
54
|
def extract_path(payload)
|
55
55
|
path = payload[:path]
|
56
|
+
strip_query_string(path)
|
57
|
+
end
|
58
|
+
|
59
|
+
def strip_query_string(path)
|
56
60
|
index = path.index('?')
|
57
61
|
index ? path[0, index] : path
|
58
62
|
end
|
@@ -104,7 +108,7 @@ module Lograge
|
|
104
108
|
return {} unless location
|
105
109
|
|
106
110
|
RequestStore.store[:lograge_location] = nil
|
107
|
-
{ location: location }
|
111
|
+
{ location: strip_query_string(location) }
|
108
112
|
end
|
109
113
|
|
110
114
|
def extract_unpermitted_params
|
data/lib/lograge/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lograge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mathias Meyer
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-03-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -138,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
138
|
version: '0'
|
139
139
|
requirements: []
|
140
140
|
rubyforge_project:
|
141
|
-
rubygems_version: 2.
|
141
|
+
rubygems_version: 2.7.3
|
142
142
|
signing_key:
|
143
143
|
specification_version: 4
|
144
144
|
summary: Tame Rails' multi-line logging into a single line per request
|