rails_semantic_logger 4.1.3 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 607046851ee5bfb0335e577fbb87f9c3ae6ab93f
4
- data.tar.gz: 3375c64b102e5461ba50412a3495c898524f63df
2
+ SHA256:
3
+ metadata.gz: bcc3cb8ba5dd32241b154e8d483caaf8571838dbfb842377d369f7c93e3bacd7
4
+ data.tar.gz: 251daa71983a8c8098ba05ce759233a897bd1b4f0e018d03b4f01fcdcf81217c
5
5
  SHA512:
6
- metadata.gz: 44f58b19256318c9fa3acb07fb08a862000acf7e15bfe27dda9fdb29052627da9c484da91fbefde02840cacdd8d7ec7556189a5297c898db39b9fde19fd1d491
7
- data.tar.gz: 860b06c8b1083e12befe6b074e1a8d0281186fa30a3f02f5342465bd44c50905a3703f90071b376a04db8c01b897d6273ab6b4fac4d81a0d6115cbd6ca5b5322
6
+ metadata.gz: dae75c826b49e9d2c2233a4c354d54938fb8f17ef63eb5ed27672f886135f5b20bdc177f2a402d5542524f0dbedfc7a9567b8fb04779550c63ecd381462f303f
7
+ data.tar.gz: b156645f8b0e0357776d9e8ea27037c16e42e54543dac192a46c7c6aeb3cb2bbfd1448e82d1dbfdf30a49f094c74e4a9215a0618906772113593ab9b9dd4b549
data/README.md CHANGED
@@ -13,8 +13,8 @@ For complete documentation see: http://rocketjob.github.io/semantic_logger/rails
13
13
 
14
14
  ## Supports
15
15
 
16
- - Ruby 1.9.3, 2.0, 2.1, 2.2 (or above) Or, JRuby 1.7, 9.0 (or above)
17
- - Rails 3.2, 4, 5 (or above)
16
+ - Ruby 2.1, 2.2 (or above) Or, JRuby 9.0 (or above)
17
+ - Rails 4, 5 (or above)
18
18
 
19
19
  ## Author
20
20
 
@@ -218,9 +218,6 @@ module RailsSemanticLogger
218
218
  # Replace the Bugsnag logger
219
219
  Bugsnag.configure { |config| config.logger = SemanticLogger[Bugsnag] } if defined?(Bugsnag)
220
220
 
221
- # Set the logger for concurrent-ruby
222
- Concurrent.global_logger = SemanticLogger[Concurrent] if defined?(Concurrent)
223
-
224
221
  # Rails Patches
225
222
  require('rails_semantic_logger/extensions/action_cable/tagged_logger_proxy') if defined?(ActionCable)
226
223
  require('rails_semantic_logger/extensions/action_controller/live') if defined?(ActionController::Live)
@@ -89,7 +89,7 @@ module ActionController
89
89
  def controller_logger(event)
90
90
  if controller = event.payload[:controller]
91
91
  begin
92
- controller.constantize.logger
92
+ controller.constantize.logger || ActionController::Base.logger
93
93
  rescue NameError
94
94
  ActionController::Base.logger
95
95
  end
@@ -1,6 +1,9 @@
1
1
  ActiveRecord::LogSubscriber
2
2
  module ActiveRecord
3
3
  class LogSubscriber
4
+ # Support Rails 3.2
5
+ IGNORE_PAYLOAD_NAMES = ['SCHEMA', 'EXPLAIN'] unless defined?(IGNORE_PAYLOAD_NAMES)
6
+
4
7
  def sql(event)
5
8
  self.class.runtime += event.duration
6
9
 
@@ -18,23 +21,37 @@ module ActiveRecord
18
21
  payload: log_payload,
19
22
  duration: event.duration
20
23
  }
24
+
21
25
  unless (payload[:binds] || []).empty?
22
26
  log_payload[:binds] = binds = {}
23
- if Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR == 0 && Rails::VERSION::TINY <= 2
27
+ if Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR == 0 && Rails::VERSION::TINY <= 2 # 5.0.0 - 5.0.2
24
28
  payload[:binds].each do |attr|
25
29
  attr_name, value = render_bind(attr)
26
30
  binds[attr_name] = value
27
31
  end
28
- elsif Rails::VERSION::MAJOR >= 5
32
+ elsif Rails::VERSION::MAJOR >= 5 && Rails::VERSION::MINOR <= 1 # 5.0.3 - 5.1.x
29
33
  casted_params = type_casted_binds(payload[:binds], payload[:type_casted_binds])
30
34
  payload[:binds].zip(casted_params).map { |attr, value|
31
35
  render_bind(attr, value)
32
36
  }
33
- else
37
+ elsif Rails::VERSION::MAJOR >= 5 # >= 5.2
38
+ casted_params = type_casted_binds(payload[:type_casted_binds])
39
+ payload[:binds].zip(casted_params).map do |attr, value|
40
+ render_bind(attr, value)
41
+ end
42
+ elsif Rails.version.to_i >= 4 # 4.x
34
43
  payload[:binds].each do |col, v|
35
44
  attr_name, value = render_bind(col, v)
36
45
  binds[attr_name] = value
37
46
  end
47
+ else # 3.x
48
+ payload[:binds].each do |col,v|
49
+ if col
50
+ binds[col.name] = v
51
+ else
52
+ binds[nil] = v
53
+ end
54
+ end
38
55
  end
39
56
  end
40
57
  debug(log)
@@ -1,3 +1,3 @@
1
1
  module RailsSemanticLogger #:nodoc
2
- VERSION = '4.1.3'
2
+ VERSION = '4.2.0'
3
3
  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.1.3
4
+ version: 4.2.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: 2017-06-16 00:00:00.000000000 Z
11
+ date: 2018-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '4.0'
19
+ version: '3.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '4.0'
26
+ version: '3.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: semantic_logger
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -84,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
84
  version: '0'
85
85
  requirements: []
86
86
  rubyforge_project:
87
- rubygems_version: 2.6.11
87
+ rubygems_version: 2.7.3
88
88
  signing_key:
89
89
  specification_version: 4
90
90
  summary: Scalable, next generation enterprise logging for Rails