epilog 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +10 -4
- data/CHANGLOG.md +14 -0
- data/epilog.gemspec +9 -8
- data/lib/epilog/filter.rb +1 -0
- data/lib/epilog/filter/filter_parameters.rb +26 -0
- data/lib/epilog/rails/action_controller_subscriber.rb +19 -11
- data/lib/epilog/rails/action_view_subscriber.rb +3 -3
- data/lib/epilog/rails/ext/action_controller.rb +5 -0
- data/lib/epilog/version.rb +1 -1
- metadata +41 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab9c7483e1069a23f488152643f2bfb8bd2598956314b8735ad220acec8c4472
|
4
|
+
data.tar.gz: 80e15c598d75805161137278ec98ed3a134526e006a9c26a7e6f1dcbb2c4025d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 107b41212249b6abf84deb5a13460f4cfe3ee7e510c311b4bc1907528947fc85ef5fa35d030c2e79607583584ecbc6d4466d3b91ff12992c3fc202e55a5a49ab
|
7
|
+
data.tar.gz: b2c35471c0b4241faeba4551716f9c4393ccdf717ff411c7d6f4f414e4a6949d0f2a3aa93347ddaf244ea4096eea3ba4cf04b6dd47867a8eb50a3aa48c6bbc66
|
data/.rubocop.yml
CHANGED
@@ -2,24 +2,30 @@
|
|
2
2
|
AllCops:
|
3
3
|
TargetRubyVersion: 2.3
|
4
4
|
|
5
|
+
Layout/AlignArguments:
|
6
|
+
EnforcedStyle: with_fixed_indentation
|
7
|
+
|
5
8
|
Layout/EndAlignment:
|
6
9
|
EnforcedStyleAlignWith: variable
|
7
10
|
|
8
11
|
Layout/AlignParameters:
|
9
12
|
EnforcedStyle: with_fixed_indentation
|
10
13
|
|
11
|
-
Layout/
|
14
|
+
Layout/IndentFirstArgument:
|
12
15
|
EnforcedStyle: consistent
|
13
16
|
|
14
|
-
Layout/
|
17
|
+
Layout/IndentFirstArrayElement:
|
15
18
|
EnforcedStyle: consistent
|
16
19
|
|
17
|
-
|
18
|
-
|
20
|
+
Layout/IndentFirstHashElement:
|
21
|
+
EnforcedStyle: consistent
|
19
22
|
|
20
23
|
Layout/MultilineMethodCallIndentation:
|
21
24
|
EnforcedStyle: indented
|
22
25
|
|
26
|
+
Style/Documentation:
|
27
|
+
Enabled: false
|
28
|
+
|
23
29
|
Style/FrozenStringLiteralComment:
|
24
30
|
Enabled: true
|
25
31
|
EnforcedStyle: always
|
data/CHANGLOG.md
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## 0.3
|
4
|
+
|
5
|
+
- Update development dependencies [#1](https://github.com/machinima/epilog/pull/1)
|
6
|
+
- Allow controllers to add context to logs [#2](https://github.com/machinima/epilog/pull/2)
|
7
|
+
- Fix removing Rails default parameters when filter_parameters are set [#4](https://github.com/machinima/epilog/pull/4)
|
8
|
+
- Add a filter using Rails filter_parameters [#3](https://github.com/machinima/epilog/pull/3)
|
9
|
+
- Change action view logs to DEBUG [#5](https://github.com/machinima/epilog/pull/5)
|
10
|
+
- Filter all request data using filter_parameters [#6](https://github.com/machinima/epilog/pull/6)
|
11
|
+
|
12
|
+
## 0.2
|
13
|
+
|
14
|
+
Initial public release
|
data/epilog.gemspec
CHANGED
@@ -19,16 +19,17 @@ Gem::Specification.new do |spec|
|
|
19
19
|
.reject { |f| f.match(%r{^spec/}) }
|
20
20
|
spec.require_paths = ['lib']
|
21
21
|
|
22
|
-
spec.add_development_dependency 'bundler', '
|
23
|
-
spec.add_development_dependency 'byebug', '~>
|
24
|
-
spec.add_development_dependency 'combustion', '~> 1.
|
22
|
+
spec.add_development_dependency 'bundler', '>= 1.12'
|
23
|
+
spec.add_development_dependency 'byebug', '~> 11.0'
|
24
|
+
spec.add_development_dependency 'combustion', '~> 1.1.0'
|
25
|
+
spec.add_development_dependency 'irb'
|
25
26
|
spec.add_development_dependency 'rails', '>= 4.2', '< 6'
|
26
|
-
spec.add_development_dependency 'rake', '~>
|
27
|
-
spec.add_development_dependency 'redcarpet', '~> 3.
|
27
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
28
|
+
spec.add_development_dependency 'redcarpet', '~> 3.5'
|
28
29
|
spec.add_development_dependency 'rspec', '~> 3.4'
|
29
30
|
spec.add_development_dependency 'rspec-rails', '~> 3.8.1'
|
30
|
-
spec.add_development_dependency 'rubocop', '
|
31
|
-
spec.add_development_dependency 'simplecov', '~> 0.
|
32
|
-
spec.add_development_dependency 'sqlite3', '~> 1.3'
|
31
|
+
spec.add_development_dependency 'rubocop', '0.75'
|
32
|
+
spec.add_development_dependency 'simplecov', '~> 0.17'
|
33
|
+
spec.add_development_dependency 'sqlite3', '~> 1.3', '< 1.4'
|
33
34
|
spec.add_development_dependency 'yard', '~> 0.9.11'
|
34
35
|
end
|
data/lib/epilog/filter.rb
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Epilog
|
4
|
+
module Filter
|
5
|
+
class FilterParameters < Blacklist
|
6
|
+
private
|
7
|
+
|
8
|
+
def filter_parameters
|
9
|
+
return @filter_parameters if @filter_parameters
|
10
|
+
|
11
|
+
filtered = Hash[
|
12
|
+
::Rails.application.config.filter_parameters.map do |p|
|
13
|
+
[p.to_s.downcase, true]
|
14
|
+
end
|
15
|
+
]
|
16
|
+
|
17
|
+
@filter_parameters = filtered if ::Rails.initialized?
|
18
|
+
filtered
|
19
|
+
end
|
20
|
+
|
21
|
+
def key?(key)
|
22
|
+
filter_parameters.key?(key.to_s.downcase)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -17,13 +17,13 @@ module Epilog
|
|
17
17
|
|
18
18
|
def process_request(event)
|
19
19
|
info do
|
20
|
-
|
20
|
+
event.payload[:context].merge(
|
21
21
|
message: response_string(event),
|
22
22
|
request: short_request_hash(event),
|
23
23
|
response: response_hash(event),
|
24
24
|
metrics: process_metrics(event.payload[:metrics]
|
25
25
|
.merge(request_runtime: event.duration.round(2)))
|
26
|
-
|
26
|
+
)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -79,6 +79,8 @@ module Epilog
|
|
79
79
|
|
80
80
|
def request_hash(event) # rubocop:disable AbcSize, MethodLength
|
81
81
|
request = event.payload[:request]
|
82
|
+
param_filter = request.send(:parameter_filter)
|
83
|
+
|
82
84
|
{
|
83
85
|
id: request.uuid,
|
84
86
|
ip: request.remote_ip,
|
@@ -86,13 +88,15 @@ module Epilog
|
|
86
88
|
protocol: request.protocol.to_s.gsub('://', ''),
|
87
89
|
method: request.request_method,
|
88
90
|
port: request.port,
|
89
|
-
path: request.
|
90
|
-
query: request.query_parameters,
|
91
|
-
cookies: request.cookies,
|
92
|
-
headers:
|
93
|
-
key
|
94
|
-
|
95
|
-
|
91
|
+
path: request.path,
|
92
|
+
query: param_filter.filter(request.query_parameters),
|
93
|
+
cookies: param_filter.filter(request.cookies),
|
94
|
+
headers: param_filter.filter(
|
95
|
+
request.headers.to_h.keep_if do |key, _value|
|
96
|
+
key =~ ActionDispatch::Http::Headers::HTTP_HEADER
|
97
|
+
end
|
98
|
+
),
|
99
|
+
params: request.filtered_parameters.except(*rails_params),
|
96
100
|
format: request.format.try(:ref),
|
97
101
|
controller: event.payload[:controller],
|
98
102
|
action: event.payload[:action]
|
@@ -104,13 +108,13 @@ module Epilog
|
|
104
108
|
{
|
105
109
|
id: request.uuid,
|
106
110
|
method: request.method,
|
107
|
-
path: request.
|
111
|
+
path: request.path
|
108
112
|
}
|
109
113
|
end
|
110
114
|
|
111
115
|
def request_string(event)
|
112
116
|
request = event.payload[:request]
|
113
|
-
"#{request.request_method} #{request.
|
117
|
+
"#{request.request_method} #{request.path}"
|
114
118
|
end
|
115
119
|
|
116
120
|
def response_hash(event)
|
@@ -147,6 +151,10 @@ module Epilog
|
|
147
151
|
obj[key] = value.round(2) if value.is_a?(Numeric)
|
148
152
|
end
|
149
153
|
end
|
154
|
+
|
155
|
+
def rails_params
|
156
|
+
@rails_params ||= RAILS_PARAMS + RAILS_PARAMS.map(&:to_s)
|
157
|
+
end
|
150
158
|
end
|
151
159
|
end
|
152
160
|
end
|
@@ -4,15 +4,15 @@ module Epilog
|
|
4
4
|
module Rails
|
5
5
|
class ActionViewSubscriber < LogSubscriber
|
6
6
|
def render_template(event)
|
7
|
-
|
7
|
+
debug { hash(event, 'Rendered template') }
|
8
8
|
end
|
9
9
|
|
10
10
|
def render_partial(event)
|
11
|
-
|
11
|
+
debug { hash(event, 'Rendered partial') }
|
12
12
|
end
|
13
13
|
|
14
14
|
def render_collection(event)
|
15
|
-
|
15
|
+
debug { hash(event, 'Rendered collection') }
|
16
16
|
end
|
17
17
|
|
18
18
|
private
|
@@ -10,6 +10,7 @@ module Epilog
|
|
10
10
|
ensure
|
11
11
|
payload[:response] = response
|
12
12
|
payload[:metrics] = epilog_metrics
|
13
|
+
payload[:context] = epilog_context
|
13
14
|
end
|
14
15
|
end
|
15
16
|
end
|
@@ -39,6 +40,10 @@ module Epilog
|
|
39
40
|
view_runtime: view_runtime
|
40
41
|
}
|
41
42
|
end
|
43
|
+
|
44
|
+
def epilog_context
|
45
|
+
{}
|
46
|
+
end
|
42
47
|
end
|
43
48
|
end
|
44
49
|
|
data/lib/epilog/version.rb
CHANGED
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: epilog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Howard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.12'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.12'
|
27
27
|
- !ruby/object:Gem::Dependency
|
@@ -30,28 +30,42 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '11.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '11.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: combustion
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 1.1.0
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: 1.1.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: irb
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rails
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -78,28 +92,28 @@ dependencies:
|
|
78
92
|
requirements:
|
79
93
|
- - "~>"
|
80
94
|
- !ruby/object:Gem::Version
|
81
|
-
version: '
|
95
|
+
version: '13.0'
|
82
96
|
type: :development
|
83
97
|
prerelease: false
|
84
98
|
version_requirements: !ruby/object:Gem::Requirement
|
85
99
|
requirements:
|
86
100
|
- - "~>"
|
87
101
|
- !ruby/object:Gem::Version
|
88
|
-
version: '
|
102
|
+
version: '13.0'
|
89
103
|
- !ruby/object:Gem::Dependency
|
90
104
|
name: redcarpet
|
91
105
|
requirement: !ruby/object:Gem::Requirement
|
92
106
|
requirements:
|
93
107
|
- - "~>"
|
94
108
|
- !ruby/object:Gem::Version
|
95
|
-
version: '3.
|
109
|
+
version: '3.5'
|
96
110
|
type: :development
|
97
111
|
prerelease: false
|
98
112
|
version_requirements: !ruby/object:Gem::Requirement
|
99
113
|
requirements:
|
100
114
|
- - "~>"
|
101
115
|
- !ruby/object:Gem::Version
|
102
|
-
version: '3.
|
116
|
+
version: '3.5'
|
103
117
|
- !ruby/object:Gem::Dependency
|
104
118
|
name: rspec
|
105
119
|
requirement: !ruby/object:Gem::Requirement
|
@@ -132,30 +146,30 @@ dependencies:
|
|
132
146
|
name: rubocop
|
133
147
|
requirement: !ruby/object:Gem::Requirement
|
134
148
|
requirements:
|
135
|
-
- -
|
149
|
+
- - '='
|
136
150
|
- !ruby/object:Gem::Version
|
137
|
-
version: '0.
|
151
|
+
version: '0.75'
|
138
152
|
type: :development
|
139
153
|
prerelease: false
|
140
154
|
version_requirements: !ruby/object:Gem::Requirement
|
141
155
|
requirements:
|
142
|
-
- -
|
156
|
+
- - '='
|
143
157
|
- !ruby/object:Gem::Version
|
144
|
-
version: '0.
|
158
|
+
version: '0.75'
|
145
159
|
- !ruby/object:Gem::Dependency
|
146
160
|
name: simplecov
|
147
161
|
requirement: !ruby/object:Gem::Requirement
|
148
162
|
requirements:
|
149
163
|
- - "~>"
|
150
164
|
- !ruby/object:Gem::Version
|
151
|
-
version: '0.
|
165
|
+
version: '0.17'
|
152
166
|
type: :development
|
153
167
|
prerelease: false
|
154
168
|
version_requirements: !ruby/object:Gem::Requirement
|
155
169
|
requirements:
|
156
170
|
- - "~>"
|
157
171
|
- !ruby/object:Gem::Version
|
158
|
-
version: '0.
|
172
|
+
version: '0.17'
|
159
173
|
- !ruby/object:Gem::Dependency
|
160
174
|
name: sqlite3
|
161
175
|
requirement: !ruby/object:Gem::Requirement
|
@@ -163,6 +177,9 @@ dependencies:
|
|
163
177
|
- - "~>"
|
164
178
|
- !ruby/object:Gem::Version
|
165
179
|
version: '1.3'
|
180
|
+
- - "<"
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: '1.4'
|
166
183
|
type: :development
|
167
184
|
prerelease: false
|
168
185
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -170,6 +187,9 @@ dependencies:
|
|
170
187
|
- - "~>"
|
171
188
|
- !ruby/object:Gem::Version
|
172
189
|
version: '1.3'
|
190
|
+
- - "<"
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
version: '1.4'
|
173
193
|
- !ruby/object:Gem::Dependency
|
174
194
|
name: yard
|
175
195
|
requirement: !ruby/object:Gem::Requirement
|
@@ -196,6 +216,7 @@ files:
|
|
196
216
|
- ".rubocop.yml"
|
197
217
|
- ".travis.yml"
|
198
218
|
- ".yardopts"
|
219
|
+
- CHANGLOG.md
|
199
220
|
- Gemfile
|
200
221
|
- LICENSE.txt
|
201
222
|
- README.md
|
@@ -212,6 +233,7 @@ files:
|
|
212
233
|
- lib/epilog.rb
|
213
234
|
- lib/epilog/filter.rb
|
214
235
|
- lib/epilog/filter/blacklist.rb
|
236
|
+
- lib/epilog/filter/filter_parameters.rb
|
215
237
|
- lib/epilog/filter/hash_key.rb
|
216
238
|
- lib/epilog/log_formatter.rb
|
217
239
|
- lib/epilog/logger.rb
|
@@ -251,7 +273,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
251
273
|
version: '0'
|
252
274
|
requirements: []
|
253
275
|
rubyforge_project:
|
254
|
-
rubygems_version: 2.7.
|
276
|
+
rubygems_version: 2.7.7
|
255
277
|
signing_key:
|
256
278
|
specification_version: 4
|
257
279
|
summary: A JSON logger with Rails support
|