rails_semantic_logger 4.11.0 → 4.12.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.
- checksums.yaml +4 -4
- data/lib/rails_semantic_logger/action_controller/log_subscriber.rb +15 -11
- data/lib/rails_semantic_logger/action_mailer/log_subscriber.rb +2 -2
- data/lib/rails_semantic_logger/engine.rb +36 -20
- data/lib/rails_semantic_logger/rack/logger.rb +7 -10
- data/lib/rails_semantic_logger/version.rb +1 -1
- metadata +10 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73a37ac27f2cf94d083cc75aa557a778f32e2de852b3be6447b072dc1da89047
|
4
|
+
data.tar.gz: 681f2145e71def6b336792fe3d581dfd89da6fd3ca471befcbd8ffa4f11abb50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d299a14cb4c3eaf282e4bf502d8e60c2a36095b138c17969cf0a8f79b0431a731adbe8963ae2017bf429f12b7f42fe65d5c199a2c5f88e984a71d4605766bea
|
7
|
+
data.tar.gz: d837dc46c0dcd38b19dcf2a62c926c91ef1775542d55c8919d3a76db2e62764ab8675890238da78ab19b157f3b920e9d92257d5b2e347bb66d0c5a2bde60441f
|
@@ -14,12 +14,22 @@ module RailsSemanticLogger
|
|
14
14
|
|
15
15
|
# Unused, but needed for Devise 401 status code monkey patch to still work.
|
16
16
|
::ActionController::Base.log_process_action(payload)
|
17
|
+
|
18
|
+
params = payload[:params]
|
17
19
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
if params.kind_of?(Hash) || params.kind_of?(::ActionController::Parameters)
|
21
|
+
# According to PR https://github.com/reidmorrison/rails_semantic_logger/pull/37/files
|
22
|
+
# params is not always a Hash.
|
23
|
+
payload[:params] = params.to_unsafe_h unless params.is_a?(Hash)
|
24
|
+
payload[:params] = params.except(*INTERNAL_PARAMS)
|
25
|
+
|
26
|
+
if payload[:params].empty?
|
27
|
+
payload.delete(:params)
|
28
|
+
elsif params["file"]
|
29
|
+
# When logging to JSON the entire tempfile is logged, so convert it to a string.
|
30
|
+
payload[:params]["file"] = params["file"].inspect
|
31
|
+
end
|
32
|
+
end
|
23
33
|
|
24
34
|
format = payload[:format]
|
25
35
|
payload[:format] = format.to_s.upcase if format.is_a?(Symbol)
|
@@ -48,12 +58,6 @@ module RailsSemanticLogger
|
|
48
58
|
payload.delete(:request)
|
49
59
|
payload.delete(:response)
|
50
60
|
|
51
|
-
params = payload[:params]
|
52
|
-
if params
|
53
|
-
# When logging to JSON the entire tempfile is logged, so convert it to a string.
|
54
|
-
params["file"] = params["file"].inspect if params["file"]
|
55
|
-
end
|
56
|
-
|
57
61
|
{
|
58
62
|
message: "Completed ##{payload[:action]}",
|
59
63
|
duration: event.duration,
|
@@ -9,7 +9,7 @@ module RailsSemanticLogger
|
|
9
9
|
message_id = event.payload[:message_id]
|
10
10
|
duration = event.duration.round(1)
|
11
11
|
if ex
|
12
|
-
|
12
|
+
log_with_formatter event: event, log_duration: true, level: :error do |fmt|
|
13
13
|
{
|
14
14
|
message: "Error delivering mail #{message_id} (#{duration}ms)",
|
15
15
|
exception: ex
|
@@ -17,7 +17,7 @@ module RailsSemanticLogger
|
|
17
17
|
end
|
18
18
|
else
|
19
19
|
message = begin
|
20
|
-
|
20
|
+
if event.payload[:perform_deliveries]
|
21
21
|
"Delivered mail #{message_id} (#{duration}ms)"
|
22
22
|
else
|
23
23
|
"Skipped delivery of mail #{message_id} as `perform_deliveries` is false"
|
@@ -1,7 +1,4 @@
|
|
1
1
|
require "rails"
|
2
|
-
require "action_controller/log_subscriber"
|
3
|
-
require "action_view/log_subscriber"
|
4
|
-
require "action_mailer/log_subscriber"
|
5
2
|
require "rails_semantic_logger/options"
|
6
3
|
|
7
4
|
module RailsSemanticLogger
|
@@ -111,7 +108,14 @@ module RailsSemanticLogger
|
|
111
108
|
Resque.logger = SemanticLogger[Resque] if defined?(Resque) && Resque.respond_to?(:logger=)
|
112
109
|
|
113
110
|
# Replace the Sidekiq logger
|
114
|
-
|
111
|
+
if defined?(Sidekiq)
|
112
|
+
if Sidekiq.respond_to?(:logger=)
|
113
|
+
Sidekiq.logger = SemanticLogger[Sidekiq]
|
114
|
+
elsif Sidekiq::VERSION[0..1] == '7.'
|
115
|
+
method = Sidekiq.server? ? :configure_server : :configure_client
|
116
|
+
Sidekiq.public_send(method) { |cfg| cfg.logger = SemanticLogger[Sidekiq] }
|
117
|
+
end
|
118
|
+
end
|
115
119
|
|
116
120
|
# Replace the Sidetiq logger
|
117
121
|
Sidetiq.logger = SemanticLogger[Sidetiq] if defined?(Sidetiq) && Sidetiq.respond_to?(:logger=)
|
@@ -186,26 +190,38 @@ module RailsSemanticLogger
|
|
186
190
|
end
|
187
191
|
|
188
192
|
# Action View
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
RailsSemanticLogger::ActionView::LogSubscriber
|
193
|
-
|
194
|
-
|
193
|
+
if defined?(::ActionView)
|
194
|
+
require "action_view/log_subscriber"
|
195
|
+
|
196
|
+
RailsSemanticLogger::ActionView::LogSubscriber.rendered_log_level = :info if config.rails_semantic_logger.rendered
|
197
|
+
RailsSemanticLogger.swap_subscriber(
|
198
|
+
::ActionView::LogSubscriber,
|
199
|
+
RailsSemanticLogger::ActionView::LogSubscriber,
|
200
|
+
:action_view
|
201
|
+
)
|
202
|
+
end
|
195
203
|
|
196
204
|
# Action Controller
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
205
|
+
if defined?(::ActionController)
|
206
|
+
require "action_controller/log_subscriber"
|
207
|
+
|
208
|
+
RailsSemanticLogger.swap_subscriber(
|
209
|
+
::ActionController::LogSubscriber,
|
210
|
+
RailsSemanticLogger::ActionController::LogSubscriber,
|
211
|
+
:action_controller
|
212
|
+
)
|
213
|
+
end
|
202
214
|
|
203
215
|
# Action Mailer
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
216
|
+
if defined?(::ActionMailer)
|
217
|
+
require "action_mailer/log_subscriber"
|
218
|
+
|
219
|
+
RailsSemanticLogger.swap_subscriber(
|
220
|
+
::ActionMailer::LogSubscriber,
|
221
|
+
RailsSemanticLogger::ActionMailer::LogSubscriber,
|
222
|
+
:action_mailer
|
223
|
+
)
|
224
|
+
end
|
209
225
|
end
|
210
226
|
|
211
227
|
#
|
@@ -35,16 +35,18 @@ module RailsSemanticLogger
|
|
35
35
|
@started_request_log_level = :debug
|
36
36
|
|
37
37
|
def call_app(request, env)
|
38
|
-
instrumenter
|
39
|
-
instrumenter.start "request.action_dispatch", request: request
|
38
|
+
instrumenter = ActiveSupport::Notifications.instrumenter
|
39
|
+
instrumenter_state = instrumenter.start "request.action_dispatch", request: request
|
40
|
+
instrumenter_finish = -> () {
|
41
|
+
instrumenter.finish_with_state(instrumenter_state, "request.action_dispatch", request: request)
|
42
|
+
}
|
40
43
|
|
41
44
|
logger.send(self.class.started_request_log_level) { started_request_message(request) }
|
42
|
-
|
43
45
|
status, headers, body = @app.call(env)
|
44
|
-
body = ::Rack::BodyProxy.new(body
|
46
|
+
body = ::Rack::BodyProxy.new(body, &instrumenter_finish)
|
45
47
|
[status, headers, body]
|
46
48
|
rescue Exception
|
47
|
-
|
49
|
+
instrumenter_finish.call
|
48
50
|
raise
|
49
51
|
end
|
50
52
|
|
@@ -90,11 +92,6 @@ module RailsSemanticLogger
|
|
90
92
|
tagged
|
91
93
|
end
|
92
94
|
|
93
|
-
def finish(request)
|
94
|
-
instrumenter = ActiveSupport::Notifications.instrumenter
|
95
|
-
instrumenter.finish "request.action_dispatch", request: request
|
96
|
-
end
|
97
|
-
|
98
95
|
def logger
|
99
96
|
self.class.logger
|
100
97
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_semantic_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Reid Morrison
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '4.
|
47
|
+
version: '4.13'
|
48
48
|
type: :runtime
|
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: '4.
|
54
|
+
version: '4.13'
|
55
55
|
description:
|
56
56
|
email:
|
57
57
|
executables: []
|
@@ -86,7 +86,11 @@ files:
|
|
86
86
|
homepage: https://logger.rocketjob.io
|
87
87
|
licenses:
|
88
88
|
- Apache-2.0
|
89
|
-
metadata:
|
89
|
+
metadata:
|
90
|
+
bug_tracker_uri: https://github.com/reidmorrison/rails_semantic_logger/issues
|
91
|
+
documentation_uri: https://logger.rocketjob.io
|
92
|
+
source_code_uri: https://github.com/reidmorrison/rails_semantic_logger/tree/4.12.0
|
93
|
+
rubygems_mfa_required: 'true'
|
90
94
|
post_install_message:
|
91
95
|
rdoc_options: []
|
92
96
|
require_paths:
|
@@ -102,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
106
|
- !ruby/object:Gem::Version
|
103
107
|
version: '0'
|
104
108
|
requirements: []
|
105
|
-
rubygems_version: 3.
|
109
|
+
rubygems_version: 3.4.9
|
106
110
|
signing_key:
|
107
111
|
specification_version: 4
|
108
112
|
summary: Feature rich logging framework that replaces the Rails logger.
|