epilog 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +4 -2
- data/CHANGELOG.md +4 -0
- data/Gemfile +5 -0
- data/epilog.gemspec +3 -3
- data/lib/epilog/rails/action_mailer_subscriber.rb +2 -0
- data/lib/epilog/rails/active_job_subscriber.rb +53 -7
- data/lib/epilog/rails/epilog_ext.rb +7 -2
- data/lib/epilog/rails/ext/action_controller.rb +12 -2
- data/lib/epilog/rails/railtie.rb +15 -2
- data/lib/epilog/version.rb +1 -1
- metadata +13 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32a54d6c7ea304907eb4dc22c25c9929b3da12567229bff59011e71d9beb6657
|
4
|
+
data.tar.gz: 6368c2823685e10c8f599e0b2a38fbe51d815276427d7678de23438cb91967f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c7043de6697ddd6ec8c5b9bd5e9c4b4f6514ac294832778df3001cee5b33095d9da4ba98c94a4d9719a543774211bd0451c9648274833b78c17acab1d06778c
|
7
|
+
data.tar.gz: b0c7afa816aafe154ac47d944baa5398c692d2c5b33f4c014460486daae83f280c070d63f8a09b67b2025f4bf9e153878b84aad848b6ce1780699e9ed75ae00d
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -4,10 +4,12 @@ rvm:
|
|
4
4
|
- 2.3
|
5
5
|
- 2.4
|
6
6
|
- 2.5
|
7
|
+
- 2.6
|
7
8
|
env:
|
8
9
|
matrix:
|
9
|
-
- RAILS_VERSION=4.2
|
10
10
|
- RAILS_VERSION=5.2
|
11
|
+
- RAILS_VERSION=6.0
|
12
|
+
- RAILS_VERSION=6.1
|
11
13
|
global:
|
12
14
|
- COVERAGE=1
|
13
15
|
- secure: 'nm0AJBULqunzS//h26lblqWHV4Kl0Ij9OPVHMI761TNeFFjP2+KKUVh4qYEKrdUDp7pk9Wa4CdAB9EFLYTJMwyK8RlSkdMLaHGT9xdOqbycBS6vkW2symvdu58SSdsNmnnFV4ebOwEmEcDhAh8SyT0ZkUVhyzGntdzOOZmULi57kOwm8QGrrr4/4xaTmDleZlTDS404nD28wJctaBT8Xa33inaYYrHLKz4xbvFFtptrPb+Arav9enljqiqOu4XjXCIP2eOSP7PHkDPuRn0JKDFT3zKmj0MIUbYkoheQL6R3tMF9zx5gm4GKbd7iunuIsjbFweiveZwZhfNGDPCICuw76UWZCrN4PpomA7XDNjbs0JVRJvnBxLZk5X3w3Sacb4zBTd+U8WH7uAb9qdD7m4xUswox4tPZDPXYObw2PDqtLlsSRn3WDKsnG0/Tt0D+kFsx43MbrvspdOzjarJsIXzU9aJqfE97nM4ZrNcktsW4PrqGflhcDVTKg+kLQj4bO0csR1W/JhGHN0JsVNUmNFN9QqpuRxxI/AmnPBtKR29DDy3BUv1b/kCZbsqq4+wbgCKDJng5VBgpG4VekOiTT2xmlwoxNK4IUAISbu7G/eyCcp33jb+27QE74a13xQsMLvh/wjh1sFEfzJvQzXFL+gjkVP4Z/+uSbc2+8/p+FKm8='
|
@@ -28,7 +30,7 @@ after_script:
|
|
28
30
|
jobs:
|
29
31
|
include:
|
30
32
|
- stage: release
|
31
|
-
rvm: 2.
|
33
|
+
rvm: 2.6
|
32
34
|
script: skip
|
33
35
|
deploy:
|
34
36
|
provider: rubygems
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/epilog.gemspec
CHANGED
@@ -21,15 +21,15 @@ Gem::Specification.new do |spec|
|
|
21
21
|
|
22
22
|
spec.add_development_dependency 'bundler', '>= 1.12'
|
23
23
|
spec.add_development_dependency 'byebug', '~> 11.0'
|
24
|
-
spec.add_development_dependency 'combustion', '~> 1.
|
24
|
+
spec.add_development_dependency 'combustion', '~> 1.3'
|
25
25
|
spec.add_development_dependency 'irb'
|
26
|
-
spec.add_development_dependency 'rails', '>= 4.2', '<
|
26
|
+
spec.add_development_dependency 'rails', '>= 4.2', '< 7'
|
27
27
|
spec.add_development_dependency 'rake', '~> 13.0'
|
28
28
|
spec.add_development_dependency 'redcarpet', '~> 3.5'
|
29
29
|
spec.add_development_dependency 'rspec', '~> 3.4'
|
30
30
|
spec.add_development_dependency 'rspec-rails', '~> 3.8.1'
|
31
31
|
spec.add_development_dependency 'rubocop', '0.75'
|
32
32
|
spec.add_development_dependency 'simplecov', '~> 0.17'
|
33
|
-
spec.add_development_dependency 'sqlite3', '~> 1.3', '< 1.
|
33
|
+
spec.add_development_dependency 'sqlite3', '~> 1.3', '< 1.5'
|
34
34
|
spec.add_development_dependency 'yard', '~> 0.9.11'
|
35
35
|
end
|
@@ -3,9 +3,27 @@
|
|
3
3
|
module Epilog
|
4
4
|
module Rails
|
5
5
|
class ActiveJobSubscriber < LogSubscriber
|
6
|
+
# rubocop:disable Metrics/MethodLength
|
6
7
|
def enqueue(event)
|
7
|
-
|
8
|
+
ex = event.payload[:exception_object]
|
9
|
+
|
10
|
+
if ex
|
11
|
+
error do
|
12
|
+
event_hash('Failed enqueuing job', event)
|
13
|
+
end
|
14
|
+
elsif event.payload[:aborted]
|
15
|
+
info do
|
16
|
+
event_hash(
|
17
|
+
'Failed enqueuing job, a before_enqueue callback' \
|
18
|
+
' halted the enqueuing execution.',
|
19
|
+
event
|
20
|
+
)
|
21
|
+
end
|
22
|
+
else
|
23
|
+
info { event_hash('Enqueued job', event) }
|
24
|
+
end
|
8
25
|
end
|
26
|
+
# rubocop:enable Metrics/MethodLength
|
9
27
|
|
10
28
|
def enqueue_at(event)
|
11
29
|
enqueue(event)
|
@@ -18,16 +36,44 @@ module Epilog
|
|
18
36
|
info { event_hash('Performing job', event) }
|
19
37
|
end
|
20
38
|
|
39
|
+
# rubocop:disable Metrics/MethodLength
|
40
|
+
# rubocop:disable Metrics/AbcSize
|
21
41
|
def perform(event)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
42
|
+
ex = event.payload[:exception_object]
|
43
|
+
if ex
|
44
|
+
error do
|
45
|
+
event_hash('Error performing job', event).merge(
|
46
|
+
metrics: {
|
47
|
+
job_runtime: event.duration
|
48
|
+
}
|
49
|
+
)
|
50
|
+
end
|
51
|
+
elsif event.payload[:aborted]
|
52
|
+
error do
|
53
|
+
event_hash(
|
54
|
+
'Error performing job, a before_perform ' \
|
55
|
+
'callback halted the job execution',
|
56
|
+
event
|
57
|
+
).merge(
|
58
|
+
metrics: {
|
59
|
+
job_runtime: event.duration
|
60
|
+
}
|
61
|
+
)
|
62
|
+
end
|
63
|
+
else
|
64
|
+
info do
|
65
|
+
event_hash('Performed job', event).merge(
|
66
|
+
metrics: {
|
67
|
+
job_runtime: event.duration
|
68
|
+
}
|
69
|
+
)
|
70
|
+
end
|
28
71
|
end
|
72
|
+
|
29
73
|
pop_context
|
30
74
|
end
|
75
|
+
# rubocop:enable Metrics/MethodLength
|
76
|
+
# rubocop:enable Metrics/AbcSize
|
31
77
|
|
32
78
|
private
|
33
79
|
|
@@ -2,10 +2,15 @@
|
|
2
2
|
|
3
3
|
module Epilog
|
4
4
|
class Logger
|
5
|
-
include LoggerSilence
|
6
|
-
|
7
5
|
def silencer
|
8
6
|
false
|
9
7
|
end
|
10
8
|
end
|
11
9
|
end
|
10
|
+
|
11
|
+
logger_silencer = if Rails::VERSION::MAJOR >= 6
|
12
|
+
ActiveSupport::LoggerSilence
|
13
|
+
else
|
14
|
+
::LoggerSilence
|
15
|
+
end
|
16
|
+
Epilog::Logger.send(:include, logger_silencer)
|
@@ -47,7 +47,17 @@ module Epilog
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
-
|
51
|
-
|
50
|
+
def prepend_controller_ext
|
51
|
+
ActionController::Base.prepend(Epilog::ActionControllerExt)
|
52
|
+
return unless defined? ActionController::API
|
53
|
+
|
52
54
|
ActionController::API.prepend(Epilog::ActionControllerExt)
|
53
55
|
end
|
56
|
+
|
57
|
+
if ::Rails::VERSION::MAJOR < 5
|
58
|
+
prepend_controller_ext
|
59
|
+
else
|
60
|
+
ActiveSupport.on_load(:action_controller_base) do
|
61
|
+
prepend_controller_ext
|
62
|
+
end
|
63
|
+
end
|
data/lib/epilog/rails/railtie.rb
CHANGED
@@ -3,6 +3,15 @@
|
|
3
3
|
module Epilog
|
4
4
|
module Rails
|
5
5
|
class Railtie < ::Rails::Railtie
|
6
|
+
def self.rails_6_1_higher?
|
7
|
+
Gem::Version.new(::Rails::VERSION::STRING) >= Gem::Version.new('6.1.0')
|
8
|
+
end
|
9
|
+
|
10
|
+
# We need this in Rails 6.
|
11
|
+
# Without this line `ActiveJob::LogSubscriber` fails
|
12
|
+
# with unknown contant error
|
13
|
+
ActiveSupport.run_load_hooks(:active_job, ActiveJob::Base)
|
14
|
+
|
6
15
|
SUBSCRIBERS = {
|
7
16
|
action_controller: ActionControllerSubscriber,
|
8
17
|
action_mailer: ActionMailerSubscriber,
|
@@ -16,7 +25,11 @@ module Epilog
|
|
16
25
|
ActionMailer::LogSubscriber,
|
17
26
|
ActionView::LogSubscriber,
|
18
27
|
ActiveRecord::LogSubscriber,
|
19
|
-
|
28
|
+
if rails_6_1_higher?
|
29
|
+
ActiveJob::LogSubscriber
|
30
|
+
else
|
31
|
+
ActiveJob::Logging::LogSubscriber
|
32
|
+
end
|
20
33
|
].freeze
|
21
34
|
|
22
35
|
config.epilog = ActiveSupport::OrderedOptions.new
|
@@ -56,7 +69,7 @@ module Epilog
|
|
56
69
|
|
57
70
|
def unsubscribe_listeners(subscriber, pattern)
|
58
71
|
notifier = ActiveSupport::Notifications.notifier
|
59
|
-
notifier.listeners_for(pattern).each do |listener|
|
72
|
+
notifier.listeners_for(Array.wrap(pattern).first).each do |listener|
|
60
73
|
if listener.delegates_to?(subscriber)
|
61
74
|
ActiveSupport::Notifications.unsubscribe(listener)
|
62
75
|
end
|
data/lib/epilog/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: epilog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Howard
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: '1.3'
|
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.3'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: irb
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -75,7 +75,7 @@ dependencies:
|
|
75
75
|
version: '4.2'
|
76
76
|
- - "<"
|
77
77
|
- !ruby/object:Gem::Version
|
78
|
-
version: '
|
78
|
+
version: '7'
|
79
79
|
type: :development
|
80
80
|
prerelease: false
|
81
81
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -85,7 +85,7 @@ dependencies:
|
|
85
85
|
version: '4.2'
|
86
86
|
- - "<"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: '
|
88
|
+
version: '7'
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: rake
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -179,7 +179,7 @@ dependencies:
|
|
179
179
|
version: '1.3'
|
180
180
|
- - "<"
|
181
181
|
- !ruby/object:Gem::Version
|
182
|
-
version: '1.
|
182
|
+
version: '1.5'
|
183
183
|
type: :development
|
184
184
|
prerelease: false
|
185
185
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -189,7 +189,7 @@ dependencies:
|
|
189
189
|
version: '1.3'
|
190
190
|
- - "<"
|
191
191
|
- !ruby/object:Gem::Version
|
192
|
-
version: '1.
|
192
|
+
version: '1.5'
|
193
193
|
- !ruby/object:Gem::Dependency
|
194
194
|
name: yard
|
195
195
|
requirement: !ruby/object:Gem::Requirement
|
@@ -204,7 +204,7 @@ dependencies:
|
|
204
204
|
- - "~>"
|
205
205
|
- !ruby/object:Gem::Version
|
206
206
|
version: 0.9.11
|
207
|
-
description:
|
207
|
+
description:
|
208
208
|
email:
|
209
209
|
- jmhoward0@gmail.com
|
210
210
|
executables: []
|
@@ -258,7 +258,7 @@ homepage: https://github.com/machinima/epilog
|
|
258
258
|
licenses:
|
259
259
|
- Apache-2.0
|
260
260
|
metadata: {}
|
261
|
-
post_install_message:
|
261
|
+
post_install_message:
|
262
262
|
rdoc_options: []
|
263
263
|
require_paths:
|
264
264
|
- lib
|
@@ -273,9 +273,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
273
273
|
- !ruby/object:Gem::Version
|
274
274
|
version: '0'
|
275
275
|
requirements: []
|
276
|
-
|
277
|
-
|
278
|
-
signing_key:
|
276
|
+
rubygems_version: 3.3.7
|
277
|
+
signing_key:
|
279
278
|
specification_version: 4
|
280
279
|
summary: A JSON logger with Rails support
|
281
280
|
test_files: []
|