logtail-rails 0.2.3 → 0.2.4

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
2
  SHA256:
3
- metadata.gz: d7123b2162f46a2a107ead8671135561f7a5d53f49a66196f4684776ad14a7c5
4
- data.tar.gz: 749ff8b0d6367026632cb6beee6a5742168aeb0b038d87b786ae683472c83409
3
+ metadata.gz: 4d238560ec59e0d1b0d936ae0b3b92e11865ba2e80fcc4adeb4d6cb43676c7ae
4
+ data.tar.gz: 97e280b2a2c9297a0862dbbd733a4a36e902928b749be07bed9c904243a167f9
5
5
  SHA512:
6
- metadata.gz: 248ef31c5d69238893ce2b0e8c0d1bc5de1a9edd94df498da0c2ef61dbe608ff0cfb2761c390eb18e70b24481bfc8455750d99340d539aed84c21feebf53d3b9
7
- data.tar.gz: fe08fa5eba61b5908202ea011153721b02c703d239cc78b7edc0d76484debb5e80faddeaa4d2bdf41fde63190dd4fec068e705262326e5829d2de683256f10ab
6
+ metadata.gz: bc9b5ab10bb6cb45a9896a1056399c5adb5a8297cc06d7b424bd077884ff3848c6892d526004a2c3dc620ff4b2ce0505fc589be9c0d3b4d60485fd8165b7d5eb
7
+ data.tar.gz: 2cbd54fa234e026c71feba8f050e41d6a5b5ae513b806548921943bade86665248a826274d949924b4607a7ce1e72e2fb31137629991ac3cf3c30f59c3d5983c
@@ -27,6 +27,7 @@ jobs:
27
27
  - truffleruby-23.0.0
28
28
  - truffleruby-22.1.0
29
29
  gemfile:
30
+ - rails-edge
30
31
  - rails-7.0
31
32
  - rails-6.1
32
33
  - rails-6.0
@@ -34,6 +35,17 @@ jobs:
34
35
  - rails-5.1
35
36
  - rails-5.0
36
37
  exclude:
38
+ - gemfile: rails-edge
39
+ ruby-version: 2.6.6
40
+ - gemfile: rails-edge
41
+ ruby-version: 2.5.8
42
+ - gemfile: rails-edge
43
+ ruby-version: jruby-9.4.3.0
44
+ - gemfile: rails-edge
45
+ ruby-version: jruby-9.2.14.0
46
+ - gemfile: rails-edge
47
+ ruby-version: truffleruby-23.0.0
48
+
37
49
  - gemfile: rails-7.0
38
50
  ruby-version: 2.6.6
39
51
  - gemfile: rails-7.0
@@ -0,0 +1,12 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rails', github: 'rails/rails', branch: 'main'
4
+
5
+ gem 'logtail'
6
+ gem 'logtail-rack'
7
+
8
+ if RUBY_PLATFORM == "java"
9
+ gem 'mime-types', '2.6.2'
10
+ end
11
+
12
+ gemspec :path => '../'
@@ -7,6 +7,7 @@ module Logtail
7
7
  # @private
8
8
  class LogSubscriber < Integrator
9
9
  def initialize
10
+ require "action_controller"
10
11
  require "action_controller/log_subscriber"
11
12
  require "logtail-rails/action_controller/log_subscriber/logtail_log_subscriber"
12
13
  rescue LoadError => e
@@ -25,6 +25,7 @@ module Logtail
25
25
  )
26
26
  end
27
27
  end
28
+ subscribe_log_level :render_template, :info if defined?(subscribe_log_level)
28
29
 
29
30
  def render_partial(event)
30
31
  return true if silence?
@@ -66,6 +67,18 @@ module Logtail
66
67
  end
67
68
  end
68
69
 
70
+ def self.attach_to(*)
71
+ super
72
+
73
+ if ::Rails::VERSION::MAJOR > 7 || ::Rails::VERSION::MAJOR == 7 && ::Rails::VERSION::MINOR >= 1
74
+ # Clean extra listeners subscribed in parent's attach_to method
75
+ ::ActiveSupport::Notifications.notifier.listeners_for("render_template.action_view")
76
+ .concat(::ActiveSupport::Notifications.notifier.listeners_for("render_layout.action_view")).flatten
77
+ .filter { |listener| listener.delegate.class == ::ActionView::LogSubscriber::Start }
78
+ .each { |listener| ActiveSupport::Notifications.unsubscribe(listener) }
79
+ end
80
+ end
81
+
69
82
  private
70
83
  def log_rendering_start(*args)
71
84
  # Consolidates 2 template rendering events into 1. We don't need 2 events for
@@ -18,6 +18,11 @@ module Logtail
18
18
  # I don't know why this has to be so complicated, but it is. This code was taken from
19
19
  # lograge :/
20
20
  def unsubscribe!(component, type)
21
+ if defined?(type.detach_from)
22
+ type.detach_from(component)
23
+ return
24
+ end
25
+
21
26
  subscriber = find(component, type)
22
27
 
23
28
  if !subscriber
@@ -1,7 +1,7 @@
1
1
  module Logtail
2
2
  module Integrations
3
3
  module Rails
4
- VERSION = "0.2.3"
4
+ VERSION = "0.2.4"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logtail-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Better Stack
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-07-14 00:00:00.000000000 Z
11
+ date: 2023-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logtail
@@ -306,6 +306,7 @@ files:
306
306
  - gemfiles/rails-6.0.gemfile
307
307
  - gemfiles/rails-6.1.gemfile
308
308
  - gemfiles/rails-7.0.gemfile
309
+ - gemfiles/rails-edge.gemfile
309
310
  - lib/logtail-rails.rb
310
311
  - lib/logtail-rails/action_controller.rb
311
312
  - lib/logtail-rails/action_controller/log_subscriber.rb