logtail-rails 0.2.3 → 0.2.5

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: d7123b2162f46a2a107ead8671135561f7a5d53f49a66196f4684776ad14a7c5
4
- data.tar.gz: 749ff8b0d6367026632cb6beee6a5742168aeb0b038d87b786ae683472c83409
3
+ metadata.gz: 97d938a7a8be17f755842dcf6625ea5cef8aee115de0e81a9a8d33722a16d2da
4
+ data.tar.gz: fecfdfab18c9b31582a52987e5271c012707bc7a3cdcb628a261a204a4933c74
5
5
  SHA512:
6
- metadata.gz: 248ef31c5d69238893ce2b0e8c0d1bc5de1a9edd94df498da0c2ef61dbe608ff0cfb2761c390eb18e70b24481bfc8455750d99340d539aed84c21feebf53d3b9
7
- data.tar.gz: fe08fa5eba61b5908202ea011153721b02c703d239cc78b7edc0d76484debb5e80faddeaa4d2bdf41fde63190dd4fec068e705262326e5829d2de683256f10ab
6
+ metadata.gz: a1f6e1992c6d09df1df6649984d52d655671e4eb7bf031294e9e3eaf2edf7fc0cd5ae403ec42de01440e66fac99c36059b014207e56be0c2d072dd51a544e53a
7
+ data.tar.gz: 63c827e685b29dce41f1c175972ef2eaf2e803ce7fedb771207fc5c3bc07e12c6edd7f9d3e53e32e71b9410d58de43ef3aa68b0d899b1434d1afffb198922995
@@ -2,7 +2,6 @@ name: build
2
2
 
3
3
  on:
4
4
  push:
5
- pull_request:
6
5
  schedule:
7
6
  - cron: '20 5 * * 1'
8
7
  workflow_dispatch:
@@ -16,17 +15,19 @@ jobs:
16
15
 
17
16
  matrix:
18
17
  ruby-version:
19
- - 3.2.2
20
- - 3.1.4
21
- - 3.0.6
22
- - 2.7.2
23
- - 2.6.6
24
- - 2.5.8
18
+ - 3.2
19
+ - 3.1
20
+ - 3.0
21
+ - 2.7
22
+ - 2.6
23
+ - 2.5
25
24
  - jruby-9.4.3.0
26
25
  - jruby-9.2.14.0
27
26
  - truffleruby-23.0.0
28
27
  - truffleruby-22.1.0
29
28
  gemfile:
29
+ - rails-edge
30
+ - rails-7.1
30
31
  - rails-7.0
31
32
  - rails-6.1
32
33
  - rails-6.0
@@ -34,19 +35,39 @@ jobs:
34
35
  - rails-5.1
35
36
  - rails-5.0
36
37
  exclude:
38
+ - gemfile: rails-edge
39
+ ruby-version: 2.6
40
+ - gemfile: rails-edge
41
+ ruby-version: 2.5
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
+
49
+ - gemfile: rails-7.1
50
+ ruby-version: 2.6
51
+ - gemfile: rails-7.1
52
+ ruby-version: 2.5
53
+ - gemfile: rails-7.1
54
+ ruby-version: jruby-9.4.3.0
55
+ - gemfile: rails-7.1
56
+ ruby-version: jruby-9.2.14.0
57
+
37
58
  - gemfile: rails-7.0
38
- ruby-version: 2.6.6
59
+ ruby-version: 2.6
39
60
  - gemfile: rails-7.0
40
- ruby-version: 2.5.8
61
+ ruby-version: 2.5
41
62
  - gemfile: rails-7.0
42
63
  ruby-version: jruby-9.2.14.0
43
64
 
44
65
  - gemfile: rails-5.2
45
- ruby-version: 3.2.2
66
+ ruby-version: 3.2
46
67
  - gemfile: rails-5.2
47
- ruby-version: 3.1.4
68
+ ruby-version: 3.1
48
69
  - gemfile: rails-5.2
49
- ruby-version: 3.0.6
70
+ ruby-version: 3.0
50
71
  - gemfile: rails-5.2
51
72
  ruby-version: jruby-9.4.3.0
52
73
  - gemfile: rails-5.2
@@ -55,11 +76,11 @@ jobs:
55
76
  ruby-version: truffleruby-23.0.0
56
77
 
57
78
  - gemfile: rails-5.1
58
- ruby-version: 3.2.2
79
+ ruby-version: 3.2
59
80
  - gemfile: rails-5.1
60
- ruby-version: 3.1.4
81
+ ruby-version: 3.1
61
82
  - gemfile: rails-5.1
62
- ruby-version: 3.0.6
83
+ ruby-version: 3.0
63
84
  - gemfile: rails-5.1
64
85
  ruby-version: jruby-9.4.3.0
65
86
  - gemfile: rails-5.1
@@ -68,11 +89,11 @@ jobs:
68
89
  ruby-version: truffleruby-22.1.0
69
90
 
70
91
  - gemfile: rails-5.0
71
- ruby-version: 3.2.2
92
+ ruby-version: 3.2
72
93
  - gemfile: rails-5.0
73
- ruby-version: 3.1.4
94
+ ruby-version: 3.1
74
95
  - gemfile: rails-5.0
75
- ruby-version: 3.0.6
96
+ ruby-version: 3.0
76
97
  - gemfile: rails-5.0
77
98
  ruby-version: jruby-9.4.3.0
78
99
  - gemfile: rails-5.0
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  [![ISC License](https://img.shields.io/badge/license-ISC-ff69b4.svg)](LICENSE.md)
6
6
  [![Gem Version](https://badge.fury.io/rb/logtail-rails.svg)](https://badge.fury.io/rb/logtail-rails)
7
- [![Build Status](https://github.com/logtail/logtail-ruby-rails/workflows/build/badge.svg)](https://github.com/logtail/logtail-ruby-rails/actions?query=workflow%3Abuild)
7
+ [![Build Status](https://github.com/logtail/logtail-ruby-rails/actions/workflows/main.yml/badge.svg)](https://github.com/logtail/logtail-ruby-rails/actions/workflows/main.yml)
8
8
 
9
9
  Collect logs directly from your Ruby on Rails projects. To start logging Ruby projects explore the [Logtail Ruby library](https://github.com/logtail/logtail-ruby).
10
10
 
@@ -1,10 +1,10 @@
1
1
  source "https://rubygems.org"
2
2
  git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
3
 
4
- ruby "3.1.2"
4
+ ruby "3.2.2"
5
5
 
6
6
  # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
7
- gem "rails", "~> 7.0.6"
7
+ gem "rails", "~> 7.1.0"
8
8
 
9
9
  # The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
10
10
  gem "sprockets-rails"
@@ -13,7 +13,7 @@ gem "sprockets-rails"
13
13
  gem "sqlite3", "~> 1.4"
14
14
 
15
15
  # Use the Puma web server [https://github.com/puma/puma]
16
- gem "puma", "~> 5.0"
16
+ gem "puma", "~> 6.0"
17
17
 
18
18
  # Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
19
19
  gem "importmap-rails"
@@ -71,4 +71,4 @@ group :test do
71
71
  gem "webdrivers"
72
72
  end
73
73
 
74
- gem "logtail-rails", "~> 0.2.0"
74
+ gem "logtail-rails", "~> 0.2.5"
@@ -9,7 +9,7 @@ Bundler.require(*Rails.groups)
9
9
  module ExampleProject
10
10
  class Application < Rails::Application
11
11
  # Initialize configuration defaults for originally generated Rails version.
12
- config.load_defaults 7.0
12
+ config.load_defaults 7.1
13
13
 
14
14
  # Configuration for the application, engines, and railties goes here.
15
15
  #
@@ -19,6 +19,6 @@ module ExampleProject
19
19
  # config.time_zone = "Central Time (US & Canada)"
20
20
  # config.eager_load_paths << Rails.root.join("extras")
21
21
 
22
- config.logger = Logtail::Logger.create_default_logger("<SOURCE_TOKEN>")
22
+ config.logger = Logtail::Logger.create_default_logger("YhLXLk5djXYbxK16moYEhjeu")
23
23
  end
24
24
  end
@@ -6,3 +6,8 @@
6
6
  Rails.application.config.filter_parameters += [
7
7
  :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
8
8
  ]
9
+
10
+ # Configure HTTP headers to be filtered from the log. Use this to limit dissemination of sensitive information.
11
+ Logtail::Integrations::Rack::HTTPEvents.http_header_filters = [
12
+ :authorization, :proxy_authorization, :cookie
13
+ ]
@@ -0,0 +1,12 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rails', '~> 7.1.0'
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 => '../'
@@ -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
@@ -16,6 +16,35 @@ module Logtail
16
16
  include ::LoggerSilence
17
17
  end
18
18
 
19
+ # Logtail::Logger also works as ActiveSupport::BroadcastLogger
20
+ def is_a?(clazz)
21
+ return true if clazz == ::ActiveSupport::BroadcastLogger
22
+
23
+ super(clazz)
24
+ end
25
+
26
+ def broadcasts
27
+ [self] + @extra_loggers
28
+ end
29
+
30
+ def broadcast_to(*io_devices_and_loggers)
31
+ io_devices_and_loggers.each do |io_device_or_logger|
32
+ extra_logger = is_a_logger?(io_device_or_logger) ? io_device_or_logger : self.class.new(io_device_or_logger)
33
+
34
+ @extra_loggers << extra_logger
35
+ end
36
+ end
37
+
38
+ def stop_broadcasting_to(io_device_or_logger)
39
+ if is_a_logger?(io_device_or_logger)
40
+ @extra_loggers.delete(logger)
41
+
42
+ return
43
+ end
44
+
45
+ @extra_loggers = @extra_loggers.reject { |logger| ::ActiveSupport::Logger.logger_outputs_to?(logger, io_device_or_logger) }
46
+ end
47
+
19
48
  def self.create_logger(*io_devices_and_loggers)
20
49
  logger = Logtail::Logger.new(*io_devices_and_loggers)
21
50
 
@@ -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.5"
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.5
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-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logtail
@@ -266,7 +266,7 @@ files:
266
266
  - example-project/config/importmap.rb
267
267
  - example-project/config/initializers/assets.rb
268
268
  - example-project/config/initializers/content_security_policy.rb
269
- - example-project/config/initializers/filter_parameter_logging.rb
269
+ - example-project/config/initializers/filter_logging.rb
270
270
  - example-project/config/initializers/inflections.rb
271
271
  - example-project/config/initializers/permissions_policy.rb
272
272
  - example-project/config/locales/en.yml
@@ -306,6 +306,8 @@ 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-7.1.gemfile
310
+ - gemfiles/rails-edge.gemfile
309
311
  - lib/logtail-rails.rb
310
312
  - lib/logtail-rails/action_controller.rb
311
313
  - lib/logtail-rails/action_controller/log_subscriber.rb
@@ -359,7 +361,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
359
361
  - !ruby/object:Gem::Version
360
362
  version: '0'
361
363
  requirements: []
362
- rubygems_version: 3.4.10
364
+ rubygems_version: 3.3.7
363
365
  signing_key:
364
366
  specification_version: 4
365
367
  summary: Better Stack Rails integration