logtail-rails 0.2.4 → 0.2.6

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: 4d238560ec59e0d1b0d936ae0b3b92e11865ba2e80fcc4adeb4d6cb43676c7ae
4
- data.tar.gz: 97e280b2a2c9297a0862dbbd733a4a36e902928b749be07bed9c904243a167f9
3
+ metadata.gz: 5832e8cb26c3fa1074500d631b899f379f5404decd1b6d2e1754412b84de1c2d
4
+ data.tar.gz: 4ac40078b3e30df1e5c95fe6cb44fb2d9ebec95c2663fdc6ab15e38d9fabaaca
5
5
  SHA512:
6
- metadata.gz: bc9b5ab10bb6cb45a9896a1056399c5adb5a8297cc06d7b424bd077884ff3848c6892d526004a2c3dc620ff4b2ce0505fc589be9c0d3b4d60485fd8165b7d5eb
7
- data.tar.gz: 2cbd54fa234e026c71feba8f050e41d6a5b5ae513b806548921943bade86665248a826274d949924b4607a7ce1e72e2fb31137629991ac3cf3c30f59c3d5983c
6
+ metadata.gz: bd874966a740cb7c21e31c577481c28b611b0c3e25801480a29e2a754f1df20c0b3894dc44ae2e08f64ff98fa088364b4242e50e6fa408878c50824823301a89
7
+ data.tar.gz: f6ed0342a87e51d35e9a1750b3397b72f32676836a620e8c524001fcf03efe8c8966b2cab008982075ccc17066023eca727e42a71c4e6fe0dff74cc9bf66e02f
@@ -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,18 +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:
30
29
  - rails-edge
30
+ - rails-7.1
31
31
  - rails-7.0
32
32
  - rails-6.1
33
33
  - rails-6.0
@@ -36,9 +36,9 @@ jobs:
36
36
  - rails-5.0
37
37
  exclude:
38
38
  - gemfile: rails-edge
39
- ruby-version: 2.6.6
39
+ ruby-version: 2.6
40
40
  - gemfile: rails-edge
41
- ruby-version: 2.5.8
41
+ ruby-version: 2.5
42
42
  - gemfile: rails-edge
43
43
  ruby-version: jruby-9.4.3.0
44
44
  - gemfile: rails-edge
@@ -46,19 +46,28 @@ jobs:
46
46
  - gemfile: rails-edge
47
47
  ruby-version: truffleruby-23.0.0
48
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
+
49
58
  - gemfile: rails-7.0
50
- ruby-version: 2.6.6
59
+ ruby-version: 2.6
51
60
  - gemfile: rails-7.0
52
- ruby-version: 2.5.8
61
+ ruby-version: 2.5
53
62
  - gemfile: rails-7.0
54
63
  ruby-version: jruby-9.2.14.0
55
64
 
56
65
  - gemfile: rails-5.2
57
- ruby-version: 3.2.2
66
+ ruby-version: 3.2
58
67
  - gemfile: rails-5.2
59
- ruby-version: 3.1.4
68
+ ruby-version: 3.1
60
69
  - gemfile: rails-5.2
61
- ruby-version: 3.0.6
70
+ ruby-version: 3.0
62
71
  - gemfile: rails-5.2
63
72
  ruby-version: jruby-9.4.3.0
64
73
  - gemfile: rails-5.2
@@ -67,11 +76,11 @@ jobs:
67
76
  ruby-version: truffleruby-23.0.0
68
77
 
69
78
  - gemfile: rails-5.1
70
- ruby-version: 3.2.2
79
+ ruby-version: 3.2
71
80
  - gemfile: rails-5.1
72
- ruby-version: 3.1.4
81
+ ruby-version: 3.1
73
82
  - gemfile: rails-5.1
74
- ruby-version: 3.0.6
83
+ ruby-version: 3.0
75
84
  - gemfile: rails-5.1
76
85
  ruby-version: jruby-9.4.3.0
77
86
  - gemfile: rails-5.1
@@ -80,11 +89,11 @@ jobs:
80
89
  ruby-version: truffleruby-22.1.0
81
90
 
82
91
  - gemfile: rails-5.0
83
- ruby-version: 3.2.2
92
+ ruby-version: 3.2
84
93
  - gemfile: rails-5.0
85
- ruby-version: 3.1.4
94
+ ruby-version: 3.1
86
95
  - gemfile: rails-5.0
87
- ruby-version: 3.0.6
96
+ ruby-version: 3.0
88
97
  - gemfile: rails-5.0
89
98
  ruby-version: jruby-9.4.3.0
90
99
  - gemfile: rails-5.0
data/README.md CHANGED
@@ -1,97 +1,22 @@
1
- # Logtail - Ruby on Rails Logging Made Easy
2
-
3
- [![Logtail ruby dashboard](https://user-images.githubusercontent.com/19272921/154085622-59997d5a-3f91-4bc9-a815-3b8ead16d28d.jpeg)](https://betterstack.com/logtail)
1
+ # [Better Stack](https://betterstack.com/logs) Rails client
4
2
 
5
- [![ISC License](https://img.shields.io/badge/license-ISC-ff69b4.svg)](LICENSE.md)
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)
8
-
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
-
11
- [Logtail](https://betterstack.com/logtail) is a hosted service that centralizes all of your logs into one place. Allowing for analysis, correlation and filtering with SQL. Actionable Grafana dashboards and collaboration come built-in. Logtail works with [any language or platform and any data source](https://betterstack.com/docs/logs/).
12
-
13
- ### Features
14
- - Simple integration.
15
- - Support for structured logging and events.
16
- - Automatically captures useful context.
17
- - Performant, light weight, with a thoughtful design.
18
-
19
- ### Supported language versions
20
- - Ruby 2.5 or newer
21
- - Rails 5.0 or newer
22
-
23
- # Installation
24
- Install the Logtail Ruby on Rails client library, run the following command:
3
+ 📣 Logtail is now part of Better Stack. [Learn more ⇗](https://betterstack.com/press/introducing-better-stack/)
25
4
 
26
- ```bash
27
- bundle add logtail-rails
28
- ```
5
+ [![Better Stack dashboard](https://github.com/logtail/logtail-python/assets/10132717/e2a1196b-7924-4abc-9b85-055e17b5d499)](https://betterstack.com/logs)
29
6
 
30
- Alternatively, add `gem "logtail-rails"` to your `Gemfile` manually and then run `bundle install`.
31
-
32
- Then add following configuration line into your `config/application.rb`:
33
-
34
- ```ruby
35
- module YourProject
36
- class Application < Rails::Application
37
- # ...
38
- # configuration of your project
39
- # ...
40
-
41
- config.logger = Logtail::Logger.create_default_logger("<SOURCE_TOKEN>")
42
- end
43
- end
44
- ```
45
-
46
- *Don't forget to replace `<SOURCE_TOKEN>` with your actual source token which you can find by going to [Better Stack Logs](https://logs.betterstack.com/dashboard) -> Source -> Edit.*
47
-
48
- ---
49
-
50
- # Example project
51
-
52
- To help you get started with using Logtail in your Ruby on Rails projects, we have prepared a simple program that showcases the usage of Logtail logger.
53
-
54
- ## Download and install the example project
55
-
56
- You can download the [example project](https://github.com/logtail/logtail-ruby-rails/tree/main/example-project) from GitHub directly or you can clone it to a select directory. Make sure you are in the projects directory and run the following command:
57
-
58
- ```bash
59
- bundle install
60
- ```
61
-
62
- This will install all dependencies listed in the `Gemfile.lock` file.
63
-
64
- Then replace `<SOURCE_TOKEN>` in `config/application.rb` with your actual source token which you can find by going to [Better Stack Logs](https://logs.betterstack.com/dashboard) -> Source -> Edit.
65
-
66
- ```ruby
67
- config.logger = Logtail::Logger.create_default_logger("<YOUR_ACTUAL_SOURCE_TOKEN>")
68
- ```
69
-
70
- ## Run the example project
71
-
72
- To run the example application, run the following command:
73
-
74
- ```bash
75
- rails server
76
- ```
7
+ [![ISC License](https://img.shields.io/badge/license-ISC-ff69b4.svg)](LICENSE.md)
8
+ [![Gem Version](https://badge.fury.io/rb/logtail-rails.svg)](https://badge.fury.io/rb/logtail-rails)
9
+ [![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)
77
10
 
78
- This will open a local server [127.0.0.1:3000.](http://127.0.0.1:3000/) On the main page, click the "Let's go!" button to generate test logs.
11
+ Experience SQL-compatible structured log management based on ClickHouse. [Learn more ⇗](https://betterstack.com/logs)
79
12
 
80
- You should see the following output:
13
+ ## Documentation
81
14
 
82
- ```bash
83
- All done!
84
- Log into your Logtail account to check your logs.
85
- ```
15
+ [Getting started ⇗](https://betterstack.com/docs/logs/ruby-and-rails/#logging-from-rails)
86
16
 
87
- This will create a total of 6 different logs, each corresponding to a different log level and one with additional structured data. You can review these logs in Logtail.
17
+ ## Need help?
18
+ Please let us know at [hello@betterstack.com](mailto:hello@betterstack.com). We're happy to help!
88
19
 
89
- ## Explore how example project works
90
-
91
- Learn how to setup Ruby logging by exploring the workings of the [example project](https://github.com/logtail/logtail-ruby-rails/tree/main/example-project) in detail.
92
-
93
20
  ---
94
-
95
- ## Get in touch
96
21
 
97
- Have any questions? Please explore the Better Stack [documentation](https://betterstack.com/docs/logs/) or contact our [support](https://betterstack.com/help).
22
+ [ISC license](https://github.com/logtail/logtail-ruby-rails/blob/main/LICENSE.md), [example project](https://github.com/logtail/logtail-ruby-rails/tree/main/example-project)
@@ -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.6"
@@ -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
  #
@@ -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 => '../'
@@ -16,6 +16,36 @@ module Logtail
16
16
  include ::LoggerSilence
17
17
  end
18
18
 
19
+ # Logtail::Logger also works as ActiveSupport::BroadcastLogger
20
+ def kind_of?(clazz)
21
+ return true if defined?(::ActiveSupport::BroadcastLogger) && clazz == ::ActiveSupport::BroadcastLogger
22
+
23
+ super(clazz)
24
+ end
25
+ alias is_a? kind_of?
26
+
27
+ def broadcasts
28
+ [self] + @extra_loggers
29
+ end
30
+
31
+ def broadcast_to(*io_devices_and_loggers)
32
+ io_devices_and_loggers.each do |io_device_or_logger|
33
+ extra_logger = is_a_logger?(io_device_or_logger) ? io_device_or_logger : self.class.new(io_device_or_logger)
34
+
35
+ @extra_loggers << extra_logger
36
+ end
37
+ end
38
+
39
+ def stop_broadcasting_to(io_device_or_logger)
40
+ if is_a_logger?(io_device_or_logger)
41
+ @extra_loggers.delete(logger)
42
+
43
+ return
44
+ end
45
+
46
+ @extra_loggers = @extra_loggers.reject { |logger| ::ActiveSupport::Logger.logger_outputs_to?(logger, io_device_or_logger) }
47
+ end
48
+
19
49
  def self.create_logger(*io_devices_and_loggers)
20
50
  logger = Logtail::Logger.new(*io_devices_and_loggers)
21
51
 
@@ -1,7 +1,7 @@
1
1
  module Logtail
2
2
  module Integrations
3
3
  module Rails
4
- VERSION = "0.2.4"
4
+ VERSION = "0.2.6"
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.4
4
+ version: 0.2.6
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-08-04 00:00:00.000000000 Z
11
+ date: 2023-10-27 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,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-7.1.gemfile
309
310
  - gemfiles/rails-edge.gemfile
310
311
  - lib/logtail-rails.rb
311
312
  - lib/logtail-rails/action_controller.rb