logtail-rails 0.1.8 → 0.2.1

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: 7eb050c970571683d40dcd025672d9fb0eebcc72261627e7716115b7e16bd3a4
4
- data.tar.gz: abc54338cfdb59ddc885fc5c3589119b21e9ce6a7bb6d7f8b73301f6f94f2233
3
+ metadata.gz: '0194357c22696c69efc90f63324d9e17b5b92c2a8a8f787a09fc56ef64939726'
4
+ data.tar.gz: 1f6023f784446349e83484c4663088b260af2f7eb62b114789380dacd154494d
5
5
  SHA512:
6
- metadata.gz: 493ff5967c0a198b4667bd693074267f4ebe6e543363496a93825e41dd03736ced0e85357c207e1c3ce225375527c9feef424e51f0bd040b977403326e410c6a
7
- data.tar.gz: d5886072cbfbd130164e68bc7d23c3aaf1e335ee2b8dbb5e115c380c57ae437e6d45ba8797c824847014e3372b4c01600692ede1701c0c283721022c01e18640
6
+ metadata.gz: 01fac73b610686a7ea103847e501a0ef69e14a08e23757e2dfe13e4cb7fe8b23c5d3bf0022aba98831ed42e95bfedc310b2458fb0d4b7510ca65f1d8d984de9d
7
+ data.tar.gz: bcc0d8246d57ab258c52964023a5239adf6794444749fa8a210ebbe29a63afcbb968e6b5ee6674c0308f39a4cbe5309d966c79529ad7693158905f1e3230fb91
@@ -1,6 +1,10 @@
1
1
  name: build
2
2
 
3
- on: [ push, pull_request ]
3
+ on:
4
+ push:
5
+ pull_request:
6
+ schedule:
7
+ - cron: '20 5 * * 1'
4
8
 
5
9
  jobs:
6
10
  test:
@@ -15,9 +19,6 @@ jobs:
15
19
  - 2.7.2
16
20
  - 2.6.6
17
21
  - 2.5.8
18
- - 2.4.10
19
- - 2.3.8
20
- - 2.2.10
21
22
  - jruby-9.2.14.0
22
23
  - truffleruby-21.0.0
23
24
  gemfile:
@@ -32,96 +33,19 @@ jobs:
32
33
  ruby-version: 2.6.6
33
34
  - gemfile: rails-edge
34
35
  ruby-version: 2.5.8
35
- - gemfile: rails-edge
36
- ruby-version: 2.4.10
37
- - gemfile: rails-edge
38
- ruby-version: 2.3.8
39
- - gemfile: rails-edge
40
- ruby-version: 2.2.10
41
36
  - gemfile: rails-edge
42
37
  ruby-version: jruby-9.2.14.0
43
38
  - gemfile: rails-edge
44
39
  ruby-version: truffleruby-21.0.0
45
40
 
46
- - ruby-version: 3.0.0
47
- gemfile: rails-5.2
48
- - ruby-version: 3.0.0
49
- gemfile: rails-5.1
50
- - ruby-version: 3.0.0
51
- gemfile: rails-5.0
52
-
53
- - gemfile: rails-6.1
54
- ruby-version: 2.4.10
55
- - gemfile: rails-6.1
56
- ruby-version: 2.3.8
57
- - gemfile: rails-6.1
58
- ruby-version: 2.2.10
59
- - gemfile: rails-6.1
60
- ruby-version: 2.2.10
61
-
62
- - gemfile: rails-6.0
63
- ruby-version: 2.4.10
64
- - gemfile: rails-6.0
65
- ruby-version: 2.3.8
66
- - gemfile: rails-6.0
67
- ruby-version: 2.2.10
68
-
69
41
  - gemfile: rails-5.2
70
- ruby-version: 2.2.10
71
-
72
- env:
73
- BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
74
- RAILS_ENV: test
75
-
76
- steps:
77
- - uses: actions/checkout@v2
78
-
79
- - name: Selected Gemfile
80
- run: echo $BUNDLE_GEMFILE
81
-
82
- - name: Set up Ruby ${{ matrix.ruby-version }}
83
- uses: ruby/setup-ruby@v1
84
- with:
85
- ruby-version: ${{ matrix.ruby-version }}
86
- bundler-cache: true
87
-
88
- - name: Run tests
89
- run: bundle exec rspec --format documentation
90
-
42
+ ruby-version: 3.0.0
91
43
 
92
- test_bundler_v1:
93
- runs-on: ubuntu-20.04
44
+ - gemfile: rails-5.1
45
+ ruby-version: 3.0.0
94
46
 
95
- strategy:
96
- fail-fast: false
97
-
98
- matrix:
99
- ruby-version:
100
- - 2.6.6
101
- - 2.5.8
102
- - 2.4.10
103
- - 2.3.8
104
- - 2.2.10
105
- gemfile:
106
- - rails-4.2
107
- - rails-4.1
108
- - rails-4.0
109
- - rails-3.2
110
-
111
- exclude:
112
- - gemfile: rails-4.1
113
- ruby-version: 2.6.6
114
- - gemfile: rails-4.1
115
- ruby-version: 2.5.8
116
- - gemfile: rails-4.1
117
- ruby-version: 2.4.10
118
-
119
- - gemfile: rails-4.0
120
- ruby-version: 2.6.6
121
- - gemfile: rails-4.0
122
- ruby-version: 2.5.8
123
- - gemfile: rails-4.0
124
- ruby-version: 2.4.10
47
+ - gemfile: rails-5.0
48
+ ruby-version: 3.0.0
125
49
 
126
50
  env:
127
51
  BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
@@ -136,7 +60,6 @@ jobs:
136
60
  - name: Set up Ruby ${{ matrix.ruby-version }}
137
61
  uses: ruby/setup-ruby@v1
138
62
  with:
139
- bundler: 1.17
140
63
  ruby-version: ${{ matrix.ruby-version }}
141
64
  bundler-cache: true
142
65
 
data/README.md CHANGED
@@ -17,8 +17,8 @@ Collect logs directly from your Ruby on Rails projects. To start logging Ruby pr
17
17
  - Performant, light weight, with a thoughtful design.
18
18
 
19
19
  ### Supported language versions
20
- - Ruby 2.7.0 or newer
21
- - Rails 6.1.4.2 or newer
20
+ - Ruby 2.5 or newer
21
+ - Rails 5.0 or newer
22
22
 
23
23
  # Installation
24
24
  Install the Logtail Ruby on Rails client library, run the following command:
@@ -1,10 +1,9 @@
1
1
  # This is an override instead of an integration because without this Logtail would not
2
2
  # work properly if ActiveSupport::TaggedLogging is used.
3
- #
4
- # This is called after 'active_support_3_tagged_logging' where the constant is loaded and
5
- # replaced. I want to make sure we don't attempt to load it again undoing the patches
6
- # applied there.
7
- if defined?(ActiveSupport::TaggedLogging)
3
+
4
+ begin
5
+ require "active_support/tagged_logging"
6
+
8
7
  module Logtail
9
8
  module Overrides
10
9
  # @private
@@ -63,4 +62,6 @@ if defined?(ActiveSupport::TaggedLogging)
63
62
  end
64
63
  end
65
64
  end
65
+
66
+ rescue Exception
66
67
  end
@@ -1,5 +1,4 @@
1
1
  # The order is relevant
2
- require "logtail-rails/overrides/active_support_3_tagged_logging"
3
2
  require "logtail-rails/overrides/active_support_tagged_logging"
4
3
  require "logtail-rails/overrides/active_support_buffered_logger"
5
4
  require "logtail-rails/overrides/lograge"
@@ -1,7 +1,7 @@
1
1
  module Logtail
2
2
  module Integrations
3
3
  module Rails
4
- VERSION = "0.1.8"
4
+ VERSION = "0.2.1"
5
5
  end
6
6
  end
7
7
  end
@@ -5,14 +5,14 @@ require "logtail-rails/version"
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "logtail-rails"
7
7
  spec.version = Logtail::Integrations::Rails::VERSION
8
- spec.authors = ["Logtail"]
8
+ spec.authors = ["Better Stack"]
9
9
  spec.email = ["hello@betterstack.com"]
10
10
 
11
11
  spec.summary = %q{Better Stack Rails integration}
12
12
  spec.homepage = "https://github.com/logtail/logtail-ruby-rails"
13
13
  spec.license = "ISC"
14
14
 
15
- spec.required_ruby_version = '>= 2.2.0'
15
+ spec.required_ruby_version = '>= 2.5.0'
16
16
 
17
17
  spec.metadata["homepage_uri"] = spec.homepage
18
18
  spec.metadata["source_code_uri"] = "https://github.com/logtail/logtail-ruby-rails"
@@ -30,9 +30,9 @@ Gem::Specification.new do |spec|
30
30
  spec.add_runtime_dependency "logtail", "~> 0.1"
31
31
  spec.add_runtime_dependency "logtail-rack", "~> 0.1"
32
32
 
33
- spec.add_runtime_dependency 'activerecord', '>= 3.0.0'
34
- spec.add_runtime_dependency 'railties', '>= 3.0.0'
35
- spec.add_runtime_dependency 'actionpack', '>= 3.0.0'
33
+ spec.add_runtime_dependency 'activerecord', '>= 5.0.0'
34
+ spec.add_runtime_dependency 'railties', '>= 5.0.0'
35
+ spec.add_runtime_dependency 'actionpack', '>= 5.0.0'
36
36
 
37
37
  spec.add_development_dependency "bundler", ">= 0.0"
38
38
 
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logtail-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
- - Logtail
7
+ - Better Stack
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
@@ -44,42 +44,42 @@ dependencies:
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 3.0.0
47
+ version: 5.0.0
48
48
  type: :runtime
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: 3.0.0
54
+ version: 5.0.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: railties
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 3.0.0
61
+ version: 5.0.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: 3.0.0
68
+ version: 5.0.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: actionpack
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 3.0.0
75
+ version: 5.0.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 3.0.0
82
+ version: 5.0.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: bundler
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -300,12 +300,6 @@ files:
300
300
  - example-project/tmp/storage/.keep
301
301
  - example-project/vendor/.keep
302
302
  - example-project/vendor/javascript/.keep
303
- - gemfiles/rails-3.0.gemfile
304
- - gemfiles/rails-3.1.gemfile
305
- - gemfiles/rails-3.2.gemfile
306
- - gemfiles/rails-4.0.gemfile
307
- - gemfiles/rails-4.1.gemfile
308
- - gemfiles/rails-4.2.gemfile
309
303
  - gemfiles/rails-5.0.gemfile
310
304
  - gemfiles/rails-5.1.gemfile
311
305
  - gemfiles/rails-5.2.gemfile
@@ -333,7 +327,6 @@ files:
333
327
  - lib/logtail-rails/log_entry.rb
334
328
  - lib/logtail-rails/logger.rb
335
329
  - lib/logtail-rails/overrides.rb
336
- - lib/logtail-rails/overrides/active_support_3_tagged_logging.rb
337
330
  - lib/logtail-rails/overrides/active_support_buffered_logger.rb
338
331
  - lib/logtail-rails/overrides/active_support_tagged_logging.rb
339
332
  - lib/logtail-rails/overrides/lograge.rb
@@ -358,14 +351,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
358
351
  requirements:
359
352
  - - ">="
360
353
  - !ruby/object:Gem::Version
361
- version: 2.2.0
354
+ version: 2.5.0
362
355
  required_rubygems_version: !ruby/object:Gem::Requirement
363
356
  requirements:
364
357
  - - ">="
365
358
  - !ruby/object:Gem::Version
366
359
  version: '0'
367
360
  requirements: []
368
- rubygems_version: 3.3.7
361
+ rubygems_version: 3.4.10
369
362
  signing_key:
370
363
  specification_version: 4
371
364
  summary: Better Stack Rails integration
@@ -1,8 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'rails', '~> 3.0.0'
4
-
5
- gem 'logtail'
6
- gem 'logtail-rack'
7
-
8
- gemspec :path => '../'
@@ -1,8 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'rails', '~> 3.1.0'
4
-
5
- gem 'logtail'
6
- gem 'logtail-rack'
7
-
8
- gemspec :path => '../'
@@ -1,8 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'rails', '~> 3.2.0'
4
-
5
- gem 'logtail'
6
- gem 'logtail-rack'
7
-
8
- gemspec :path => '../'
@@ -1,12 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'rails', '~> 4.0.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 => '../'
@@ -1,12 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'rails', '~> 4.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 => '../'
@@ -1,12 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'rails', '~> 4.2.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 => '../'
@@ -1,111 +0,0 @@
1
- # Please note, this patch is merely an upgrade, backporting improved tagged logging code
2
- # from newer versions of Rails:
3
- # https://github.com/rails/rails/blob/5-1-stable/activesupport/lib/active_support/tagged_logging.rb
4
- # The behavior of tagged logging will not change in any way.
5
- #
6
- # This patch is specifically for Rails 3. The legacy approach to wrapping the logger in
7
- # ActiveSupport::TaggedLogging is rather poor, hence the reason it was changed entirely
8
- # for Rails 4 and 5. The problem is that ActiveSupport::TaggedLogging is a wrapping
9
- # class that entirely redefines the public API for the logger. As a result, any deviations
10
- # from this API in the logger are not exposed (such as accepting event data as a second argument).
11
- # This is assuming, so we're fixing it here.
12
-
13
- begin
14
- require "active_support/tagged_logging"
15
-
16
- # Instead of patching the class we're pulling the code from Rails master. This brings in
17
- # a number of improvements while also addressing the issue above.
18
- if ActiveSupport::TaggedLogging.instance_of?(Class)
19
- ActiveSupport.send(:remove_const, :TaggedLogging)
20
-
21
- require "active_support/core_ext/module/delegation"
22
- require "active_support/core_ext/object/blank"
23
- require "logger"
24
-
25
- module ActiveSupport
26
- # Wraps any standard Logger object to provide tagging capabilities.
27
- #
28
- # logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT))
29
- # logger.tagged('BCX') { logger.info 'Stuff' } # Logs "[BCX] Stuff"
30
- # logger.tagged('BCX', "Jason") { logger.info 'Stuff' } # Logs "[BCX] [Jason] Stuff"
31
- # logger.tagged('BCX') { logger.tagged('Jason') { logger.info 'Stuff' } } # Logs "[BCX] [Jason] Stuff"
32
- #
33
- # This is used by the default Rails.logger as configured by Railties to make
34
- # it easy to stamp log lines with subdomains, request ids, and anything else
35
- # to aid debugging of multi-user production applications.
36
- module TaggedLogging
37
- module Formatter # :nodoc:
38
- # This method is invoked when a log event occurs.
39
- def call(severity, timestamp, progname, msg)
40
- super(severity, timestamp, progname, "#{tags_text}#{msg}")
41
- end
42
-
43
- def tagged(*tags)
44
- new_tags = push_tags(*tags)
45
- yield self
46
- ensure
47
- pop_tags(new_tags.size)
48
- end
49
-
50
- def push_tags(*tags)
51
- tags.flatten.reject(&:blank?).tap do |new_tags|
52
- current_tags.concat new_tags
53
- end
54
- end
55
-
56
- def pop_tags(size = 1)
57
- current_tags.pop size
58
- end
59
-
60
- def clear_tags!
61
- current_tags.clear
62
- end
63
-
64
- def current_tags
65
- # We use our object ID here to avoid conflicting with other instances
66
- thread_key = @thread_key ||= "activesupport_tagged_logging_tags:#{object_id}".freeze
67
- Thread.current[thread_key] ||= []
68
- end
69
-
70
- def tags_text
71
- tags = current_tags
72
- if tags.any?
73
- tags.collect { |tag| "[#{tag}] " }.join
74
- end
75
- end
76
- end
77
-
78
- # Simple formatter which only displays the message.
79
- class SimpleFormatter < ::Logger::Formatter
80
- # This method is invoked when a log event occurs
81
- def call(severity, timestamp, progname, msg)
82
- "#{String === msg ? msg : msg.inspect}\n"
83
- end
84
- end
85
-
86
- def self.new(logger)
87
- if logger.respond_to?(:formatter=) && logger.respond_to?(:formatter)
88
- # Ensure we set a default formatter so we aren't extending nil!
89
- logger.formatter ||= SimpleFormatter.new
90
- logger.formatter.extend Formatter
91
- end
92
-
93
- logger.extend(self)
94
- end
95
-
96
- delegate :push_tags, :pop_tags, :clear_tags!, to: :formatter
97
-
98
- def tagged(*tags)
99
- formatter.tagged(*tags) { yield self }
100
- end
101
-
102
- def flush
103
- clear_tags!
104
- super if defined?(super)
105
- end
106
- end
107
- end
108
- end
109
-
110
- rescue Exception
111
- end