ezlog 0.10.0 → 0.10.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 522f8d12a7a34a7aa83c51c6729dd212909979a3c0db32ad622436056be3ea03
4
- data.tar.gz: ebf173e4431cb016de8e6a14b418b71106221982d3ebc082d53b2ed0a31fd3b5
3
+ metadata.gz: 5a89b74f63f86ae29c07305e46bf13c8947b182e191e47e3f62b7e44871e29b2
4
+ data.tar.gz: 4fdfa0f12bd2b3329cedbf07a141bae85d33e4330bf0b09cd1f56dec5222e76d
5
5
  SHA512:
6
- metadata.gz: c9efef1e23b6b8b77689d513665676aad77340d04131ca6241b565ac2cf7e8e78f21dbb0adf8ea06ce2a76008b12d7d350cbd7ea35de6d2228367b486bbda7b8
7
- data.tar.gz: 14a749943851eadf758f2e71f0a9680f9af86c2b2895e5a946918d50696fe1f19ccacb090b37f40935d972150fb18af1d6602bb93b711917a471b8d8b4ced249
6
+ metadata.gz: 7b7803f8b7d10219752ec93b7f5a462bc34a299047f7f1216673850d1d59ee4211ed4b459427f8b041e6e6dc937abe7a9b2073aadc97077d15b06a6c4ca708cf
7
+ data.tar.gz: 6dac05cf4c985db51560b8191bdb8f33ddfd6645a846d6d5e145184500b9dae8218ca9c9006ff005b2e672373ae4fe8252e2e19e31b356943ad80d85f625fa5c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ### 0.10.1 (2022-01-22)
2
+
3
+ [Full Changelog](https://github.com/emartech/ezlog/compare/v0.10.0...v0.10.1)
4
+
5
+ * Fix
6
+ * Fixed a bug where `ActionView::LogSubscriber` was potentially not (eager)loaded by the time we tried to detach it.
7
+ With this fix Rails 6.1 running on Ruby 3 should be fully supported.
8
+
1
9
  ### 0.10.0 (2021-07-01)
2
10
 
3
11
  [Full Changelog](https://github.com/emartech/ezlog/compare/v0.9.6...v0.10.0)
data/lib/ezlog/railtie.rb CHANGED
@@ -42,7 +42,10 @@ module Ezlog
42
42
  case ::Rails::VERSION::MAJOR
43
43
  when 6
44
44
  ::ActionController::LogSubscriber.detach_from :action_controller
45
- ::ActionView::LogSubscriber.detach_from :action_view
45
+ if defined? ::ActionView
46
+ require 'action_view/log_subscriber' unless defined? ::ActionView::LogSubscriber
47
+ ::ActionView::LogSubscriber.detach_from :action_view
48
+ end
46
49
  if defined? ::ActiveRecord
47
50
  ::ActiveRecord::LogSubscriber.detach_from :active_record
48
51
  Ezlog::Rails::LogSubscriber.attach Ezlog::Rails::ActiveRecord::LogSubscriber, :active_record
@@ -70,7 +73,9 @@ module Ezlog
70
73
  ::Sidekiq.configure_server do |config|
71
74
  config.options[:job_logger] = Ezlog::Sidekiq::JobLogger
72
75
  config.error_handlers << Ezlog::Sidekiq::ErrorLogger.new
73
- config.error_handlers.delete_if { |handler| handler.is_a? ::Sidekiq::ExceptionHandler::Logger }
76
+ if defined?(::Sidekiq::ExceptionHandler) && defined?(::Sidekiq::ExceptionHandler::Logger)
77
+ config.error_handlers.delete_if { |handler| handler.is_a? ::Sidekiq::ExceptionHandler::Logger }
78
+ end
74
79
  config.death_handlers << Ezlog::Sidekiq::DeathLogger.new
75
80
  end
76
81
  end
@@ -5,14 +5,18 @@ module Ezlog
5
5
  class JobLogger
6
6
  include LogContextHelper
7
7
 
8
+ def initialize(logger = ::Sidekiq.logger)
9
+ @logger = logger
10
+ end
11
+
8
12
  def call(job_hash, _queue)
9
13
  within_log_context(JobContext.from_job_hash(job_hash)) do
10
14
  begin
11
- logger.info "#{job_hash['class']} started"
15
+ @logger.info "#{job_hash['class']} started"
12
16
  benchmark { yield }
13
- logger.info message: "#{job_hash['class']} finished"
17
+ @logger.info message: "#{job_hash['class']} finished"
14
18
  rescue Exception
15
- logger.info message: "#{job_hash['class']} failed"
19
+ @logger.info message: "#{job_hash['class']} failed"
16
20
  raise
17
21
  end
18
22
  end
@@ -23,11 +27,11 @@ module Ezlog
23
27
  end
24
28
 
25
29
  def prepare(job_hash, &_block)
26
- old_log_level = logger.level
27
- logger.level = job_hash['log_level'] || logger.level
30
+ old_log_level = @logger.level
31
+ @logger.level = job_hash['log_level'] || @logger.level
28
32
  yield
29
33
  ensure
30
- logger.level = old_log_level
34
+ @logger.level = old_log_level
31
35
  end
32
36
 
33
37
  private
@@ -39,10 +43,6 @@ module Ezlog
39
43
  end_time = ::Process.clock_gettime(::Process::CLOCK_MONOTONIC)
40
44
  add_to_log_context duration_sec: (end_time - start_time).round(3)
41
45
  end
42
-
43
- def logger
44
- ::Sidekiq.logger
45
- end
46
46
  end
47
47
  end
48
48
  end
data/lib/ezlog/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ezlog
2
- VERSION = '0.10.0'
2
+ VERSION = '0.10.3'
3
3
  end
data/repo-info.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "is_in_production": true,
3
+ "is_scannable": true,
4
+ "is_critical": false,
5
+ "contact": "g-gsuite-smartinsight@emarsys.com",
6
+ "hosted": null
7
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ezlog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zoltan Ormandi
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-01 00:00:00.000000000 Z
11
+ date: 2022-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logging
@@ -136,7 +136,7 @@ dependencies:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '5.0'
139
- description:
139
+ description:
140
140
  email:
141
141
  - zoltan.ormandi@emarsys.com
142
142
  executables: []
@@ -172,12 +172,13 @@ files:
172
172
  - lib/ezlog/sidekiq/job_logger.rb
173
173
  - lib/ezlog/version.rb
174
174
  - lib/sequel/extensions/ezlog_logging.rb
175
+ - repo-info.json
175
176
  homepage: https://github.com/emartech/ezlog
176
177
  licenses:
177
178
  - MIT
178
179
  metadata:
179
180
  changelog_uri: https://github.com/emartech/ezlog/blob/master/CHANGELOG.md
180
- post_install_message:
181
+ post_install_message:
181
182
  rdoc_options: []
182
183
  require_paths:
183
184
  - lib
@@ -192,8 +193,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
192
193
  - !ruby/object:Gem::Version
193
194
  version: '0'
194
195
  requirements: []
195
- rubygems_version: 3.1.2
196
- signing_key:
196
+ rubygems_version: 3.3.7
197
+ signing_key:
197
198
  specification_version: 4
198
199
  summary: A zero-configuration logging solution for projects using Sidekiq, Rails,
199
200
  Sequel, etc.