silencer 1.0.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +48 -33
- data/lib/silencer/hush.rb +4 -2
- data/lib/silencer/methods.rb +3 -1
- data/lib/silencer/rack/logger.rb +24 -3
- data/lib/silencer/{environment.rb → rails/environment.rb} +11 -14
- data/lib/silencer/rails/logger.rb +14 -18
- data/lib/silencer/util.rb +2 -0
- data/lib/silencer/version.rb +3 -1
- data/lib/silencer.rb +1 -1
- data/spec/silencer/rack/logger_spec.rb +37 -37
- data/spec/silencer/rails/logger_spec.rb +21 -2
- data/spec/spec_helper.rb +3 -0
- metadata +7 -9
- data/lib/silencer/logger.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 63363db7eb9e93e891e6910a11e53919acfaab80e63a280544e9b7c1b3eed686
|
4
|
+
data.tar.gz: 347c68c4cf21b860ab12497a684b5b037f980ef1649ae9bdc03fda713870703e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b631a27a0bb92c343ff55f5976416b44d23cbe9f520d412890c98ba1c7d2489a283404d8b0d70a2ac2ee0278d5578f52affcc37d7b891809e8907aaac96a85de
|
7
|
+
data.tar.gz: 4435eb5f9254a7fd2266947dcef3b4776b41e8e1579edab6adb2a550d6bd2c6f5b5903e596dfa741a9bbdda21b76c68dbe30ec40bf8e13c7bae557b8ab90d731
|
data/README.md
CHANGED
@@ -1,13 +1,9 @@
|
|
1
1
|
# Silencer
|
2
2
|
|
3
|
-
|
4
3
|
[![Gem Version](http://img.shields.io/gem/v/silencer.svg)][gem]
|
5
|
-
|
6
|
-
[![Dependency Status](http://img.shields.io/gemnasium/stve/silencer.svg)][gemnasium]
|
4
|
+
![Tests](https://github.com/stve/silencer/actions/workflows/ci.yml/badge.svg)
|
7
5
|
|
8
6
|
[gem]: https://rubygems.org/gems/silencer
|
9
|
-
[travis]: https://travis-ci.org/stve/silencer
|
10
|
-
[gemnasium]: https://gemnasium.com/stve/silencer
|
11
7
|
|
12
8
|
Silencer is a simple rack-middleware for Rails that can selectively disable logging on per-action basis. It's based on a [blog post](http://dennisreimann.de/blog/silencing-the-rails-log-on-a-per-action-basis/) by Dennis Reimann.
|
13
9
|
|
@@ -17,7 +13,15 @@ __Note__: Silencer is only threadsafe in Rails version 4.2.6 and later.
|
|
17
13
|
|
18
14
|
Just add silencer to your Gemfile:
|
19
15
|
|
20
|
-
|
16
|
+
```ruby
|
17
|
+
gem 'silencer', require: false
|
18
|
+
```
|
19
|
+
|
20
|
+
### Upgrading to version 2.0
|
21
|
+
|
22
|
+
__Note:__ 1.x versions of silencer detected the presence of Rails when it was required. This made it easy to use silencer for most applications, but made assumptions on usage.
|
23
|
+
|
24
|
+
In version 2.0, you'll need to require the correct logger within your application. See the Usage documentation for more details.
|
21
25
|
|
22
26
|
## Usage
|
23
27
|
|
@@ -26,19 +30,24 @@ Just add silencer to your Gemfile:
|
|
26
30
|
Create an initializer (like `config/initializers/silencer.rb`) with the contents:
|
27
31
|
|
28
32
|
```ruby
|
29
|
-
require 'silencer/logger'
|
33
|
+
require 'silencer/rails/logger'
|
30
34
|
|
31
35
|
Rails.application.configure do
|
32
|
-
config.middleware.swap
|
36
|
+
config.middleware.swap(
|
37
|
+
Rails::Rack::Logger,
|
38
|
+
Silencer::Logger,
|
39
|
+
config.log_tags,
|
40
|
+
silence: ["/noisy/action.json"]
|
41
|
+
)
|
33
42
|
end
|
34
43
|
```
|
35
44
|
|
36
45
|
### Rack
|
37
46
|
|
38
47
|
```ruby
|
39
|
-
require 'silencer/logger'
|
48
|
+
require 'silencer/rack/logger'
|
40
49
|
|
41
|
-
use Silencer::Logger, :
|
50
|
+
use Silencer::Logger, silence: ["/noisy/action.json"]
|
42
51
|
```
|
43
52
|
|
44
53
|
## Configuration
|
@@ -46,44 +55,50 @@ use Silencer::Logger, :silence => ["/noisy/action.json"]
|
|
46
55
|
Or if you'd prefer, you can pass it regular expressions:
|
47
56
|
|
48
57
|
```ruby
|
49
|
-
config.middleware.swap
|
58
|
+
config.middleware.swap(
|
59
|
+
Rails::Rack::Logger,
|
60
|
+
Silencer::Logger,
|
61
|
+
config.log_tags,
|
62
|
+
silence: [%r{^/assets/}]
|
63
|
+
)
|
50
64
|
```
|
51
65
|
|
52
66
|
Or you can silence specific request methods only:
|
53
67
|
|
54
68
|
```ruby
|
55
|
-
config.middleware.swap
|
69
|
+
config.middleware.swap(
|
70
|
+
Rails::Rack::Logger,
|
71
|
+
Silencer::Logger,
|
72
|
+
config.log_tags,
|
73
|
+
get: [%r{^/assets/}],
|
74
|
+
post: [%r{^/some_path}]
|
75
|
+
)
|
56
76
|
```
|
57
77
|
|
58
|
-
Silencer's logger will serve as a drop-in replacement for Rails' default logger. It will not suppress any logging by default, simply pass it an array of
|
78
|
+
Silencer's logger will serve as a drop-in replacement for Rails' default logger. It will not suppress any logging by default, simply pass it an array of URLs via the options hash. You can also send an `X-SILENCE-LOGGER` header (with any value) with your request and that will also produce the same behavior.
|
59
79
|
|
60
80
|
### All options
|
61
81
|
|
62
82
|
Silencer supports the following configuration options.
|
63
83
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
Rails 2.3.x introduced a tagged logging feature. If you are using tagged logging with Rails 2.3 you can also pass taggers via the middleware:
|
78
|
-
|
79
|
-
```ruby
|
80
|
-
config.middleware.swap Rails::Rack::Logger, Silencer::Logger, config.log_tags, :silence => [%r{^/assets/}]
|
81
|
-
```
|
84
|
+
| Configuration | Description | Default |
|
85
|
+
|---------------|-------------|---------|
|
86
|
+
| `silence` | Silences matching requests regardless of request method | None |
|
87
|
+
| `get` | Silences matching GET requests | None |
|
88
|
+
| `head` | Silences matching HEAD requests | None |
|
89
|
+
| `post` | Silences matching POST requests | None |
|
90
|
+
| `put` | Silences matching PUT requests | None |
|
91
|
+
| `delete` | Silences matching DELETE requests | None |
|
92
|
+
| `patch` | Silences matching PATCH requests | None |
|
93
|
+
| `trace` | Silences matching TRACE requests | None |
|
94
|
+
| `connect` | Silences matching CONNECT requests | None |
|
95
|
+
| `options` | Silences matching OPTIONS requests | None |
|
96
|
+
| `enable_header` | Enable/disable X-SILENCE-LOGGER header support | `true` |
|
82
97
|
|
83
98
|
## Note on Patches/Pull Requests
|
84
99
|
|
85
100
|
* Fork the project.
|
86
|
-
* Make your feature addition or
|
101
|
+
* Make your feature addition or bugfix.
|
87
102
|
* Add tests for it. This is important so I don't break it in a
|
88
103
|
future version unintentionally.
|
89
104
|
* Commit, do not mess with rakefile, version, or history.
|
@@ -92,4 +107,4 @@ config.middleware.swap Rails::Rack::Logger, Silencer::Logger, config.log_tags, :
|
|
92
107
|
|
93
108
|
## Copyright
|
94
109
|
|
95
|
-
Copyright (c) 2012 Steve Agalloco. See [LICENSE](https://github.com/spagalloco/silencer/blob/
|
110
|
+
Copyright (c) 2012 Steve Agalloco. See [LICENSE](https://github.com/spagalloco/silencer/blob/main/LICENSE.md) for details.
|
data/lib/silencer/hush.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Silencer
|
2
4
|
module Hush
|
3
5
|
private
|
4
6
|
|
5
|
-
def silence_request?(env)
|
6
|
-
(silent_header?(env) || silent_path?(env))
|
7
|
+
def silence_request?(env, enable_header: true)
|
8
|
+
((enable_header && silent_header?(env)) || silent_path?(env))
|
7
9
|
end
|
8
10
|
|
9
11
|
def silent_header?(env)
|
data/lib/silencer/methods.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Silencer
|
2
4
|
module Methods
|
3
|
-
METHODS = [
|
5
|
+
METHODS = %i[options get head post put delete trace connect patch]
|
4
6
|
|
5
7
|
def define_routes(silence_paths, opts)
|
6
8
|
METHODS.each_with_object({}) do |method, routes|
|
data/lib/silencer/rack/logger.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rack/logger'
|
2
4
|
require 'silencer/hush'
|
3
5
|
require 'silencer/methods'
|
@@ -15,16 +17,35 @@ module Silencer
|
|
15
17
|
@silence = wrap(opts.delete(:silence))
|
16
18
|
@routes = define_routes(@silence, opts)
|
17
19
|
|
20
|
+
@enable_header = opts.delete(:enable_header) { true }
|
21
|
+
|
18
22
|
super(app, *args)
|
19
23
|
end
|
20
24
|
|
21
25
|
def call(env)
|
22
|
-
|
23
|
-
|
26
|
+
if silence_request?(env, enable_header: @enable_header)
|
27
|
+
quiet(env) do
|
28
|
+
super
|
29
|
+
end
|
30
|
+
else
|
31
|
+
super
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def quiet(env)
|
38
|
+
old_logger = env['rack.logger']
|
39
|
+
logger = ::Logger.new(env['rack.errors'])
|
40
|
+
logger.level = ::Logger::ERROR
|
24
41
|
|
25
42
|
env['rack.logger'] = logger
|
26
|
-
|
43
|
+
yield
|
44
|
+
ensure
|
45
|
+
env['rack.logger'] = old_logger
|
27
46
|
end
|
28
47
|
end
|
29
48
|
end
|
49
|
+
|
50
|
+
Logger = Silencer::Rack::Logger
|
30
51
|
end
|
@@ -1,8 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Silencer
|
2
4
|
module Environment
|
3
|
-
RAILS_2_3 = /^2.3/
|
4
|
-
RAILS_3_2 = /^3.2/
|
5
5
|
RAILS_4 = /^4/
|
6
|
+
RAILS_5 = /^5/
|
7
|
+
|
8
|
+
module_function
|
6
9
|
|
7
10
|
def rails?
|
8
11
|
defined?(::Rails)
|
@@ -10,26 +13,20 @@ module Silencer
|
|
10
13
|
|
11
14
|
def rails_version
|
12
15
|
return unless rails?
|
13
|
-
::Rails::VERSION::STRING
|
14
|
-
end
|
15
|
-
|
16
|
-
def rails2?
|
17
|
-
rails_version =~ RAILS_2_3
|
18
|
-
end
|
19
16
|
|
20
|
-
|
21
|
-
rails_version =~ RAILS_3_2
|
17
|
+
::Rails::VERSION::STRING
|
22
18
|
end
|
23
19
|
|
24
20
|
def rails4?
|
25
21
|
rails_version =~ RAILS_4
|
26
22
|
end
|
27
23
|
|
28
|
-
def
|
29
|
-
|
24
|
+
def rails5?
|
25
|
+
rails_version =~ RAILS_5
|
30
26
|
end
|
31
27
|
|
32
|
-
|
33
|
-
|
28
|
+
def tagged_logger?
|
29
|
+
rails4? || rails5?
|
30
|
+
end
|
34
31
|
end
|
35
32
|
end
|
@@ -1,21 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails/rack/logger'
|
1
4
|
require 'silencer/hush'
|
2
5
|
require 'silencer/methods'
|
3
6
|
require 'silencer/util'
|
7
|
+
require 'silencer/rails/environment'
|
4
8
|
|
5
9
|
module Silencer
|
6
|
-
# rubocop:disable Style/ConstantName
|
7
|
-
RailsLogger = begin
|
8
|
-
if Silencer::Environment.rails2?
|
9
|
-
require 'rails/rack/log_tailer'
|
10
|
-
::Rails::Rack::LogTailer
|
11
|
-
else
|
12
|
-
require 'rails/rack/logger'
|
13
|
-
::Rails::Rack::Logger
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
10
|
module Rails
|
18
|
-
class Logger <
|
11
|
+
class Logger < ::Rails::Rack::Logger
|
19
12
|
include Silencer::Hush
|
20
13
|
include Silencer::Methods
|
21
14
|
include Silencer::Util
|
@@ -25,7 +18,10 @@ module Silencer
|
|
25
18
|
@silence = wrap(opts.delete(:silence))
|
26
19
|
@routes = define_routes(@silence, opts)
|
27
20
|
|
28
|
-
|
21
|
+
@enable_header = opts.delete(:enable_header) { true }
|
22
|
+
|
23
|
+
normalized_args = normalize(args)
|
24
|
+
if normalized_args
|
29
25
|
super(app, normalized_args)
|
30
26
|
else
|
31
27
|
super(app)
|
@@ -33,7 +29,7 @@ module Silencer
|
|
33
29
|
end
|
34
30
|
|
35
31
|
def call(env)
|
36
|
-
if silence_request?(env)
|
32
|
+
if silence_request?(env, enable_header: @enable_header)
|
37
33
|
quiet do
|
38
34
|
super
|
39
35
|
end
|
@@ -53,10 +49,8 @@ module Silencer
|
|
53
49
|
end
|
54
50
|
|
55
51
|
# This is threadsafe in Rails 4.2.6+
|
56
|
-
def quiet_with_silence
|
57
|
-
::Rails.logger.silence
|
58
|
-
yield
|
59
|
-
end
|
52
|
+
def quiet_with_silence(&block)
|
53
|
+
::Rails.logger.silence(&block)
|
60
54
|
end
|
61
55
|
|
62
56
|
# This is not threadsafe
|
@@ -79,4 +73,6 @@ module Silencer
|
|
79
73
|
end
|
80
74
|
end
|
81
75
|
end
|
76
|
+
|
77
|
+
Logger = Silencer::Rails::Logger
|
82
78
|
end
|
data/lib/silencer/util.rb
CHANGED
data/lib/silencer/version.rb
CHANGED
data/lib/silencer.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
@@ -1,63 +1,63 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
4
|
+
require 'silencer/rack/logger'
|
2
5
|
|
3
6
|
describe Silencer::Rack::Logger do
|
4
|
-
let(:app)
|
7
|
+
let(:app) do
|
8
|
+
lambda { |env|
|
9
|
+
log = env['rack.logger']
|
10
|
+
log.info('ohai')
|
5
11
|
|
6
|
-
|
7
|
-
|
12
|
+
[200, {'Content-Type' => 'text/plain'}, ['Hello, World!']]
|
13
|
+
}
|
14
|
+
end
|
8
15
|
|
9
|
-
|
10
|
-
|
16
|
+
let(:errors) do
|
17
|
+
StringIO.new
|
11
18
|
end
|
12
19
|
|
13
|
-
it 'quiets the log when configured with a
|
14
|
-
|
20
|
+
it 'quiets the log when configured with a silenced path' do
|
21
|
+
a = Rack::Lint.new(Silencer::Rack::Logger.new(app, silence: ['/']))
|
22
|
+
Rack::MockRequest.new(a).get('/', 'rack.errors' => errors)
|
23
|
+
expect(errors).not_to match('ohai')
|
24
|
+
end
|
15
25
|
|
16
|
-
|
17
|
-
|
26
|
+
it 'quiets the log when configured with a regex' do
|
27
|
+
a = Rack::Lint.new(Silencer::Rack::Logger.new(app, silence: [/assets/]))
|
28
|
+
Rack::MockRequest.new(a).get('/assets/application.css', 'rack.errors' => errors)
|
29
|
+
expect(errors).not_to match('ohai')
|
18
30
|
end
|
19
31
|
|
20
|
-
%w
|
32
|
+
%w[OPTIONS GET POST PUT DELETE PATCH].each do |method|
|
21
33
|
it "quiets the log when configured with a silenced path for #{method} requests" do
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
.call(Rack::MockRequest.env_for('/', method: method))
|
34
|
+
a = Rack::Lint.new(Silencer::Rack::Logger.new(app, method.downcase.to_sym => ['/']))
|
35
|
+
Rack::MockRequest.new(a).send(method.downcase.to_sym, '/', 'rack.errors' => errors)
|
36
|
+
expect(errors).not_to match('ohai')
|
26
37
|
end
|
27
38
|
|
28
39
|
it "quiets the log when configured with a regex for #{method} requests" do
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
.call(Rack::MockRequest.env_for('/assets/application.css', method: method))
|
40
|
+
a = Rack::Lint.new(Silencer::Rack::Logger.new(app, method.downcase.to_sym => [/assets/]))
|
41
|
+
Rack::MockRequest.new(a).send(method.downcase.to_sym, '/assets/application.css', 'rack.errors' => errors)
|
42
|
+
expect(errors).not_to match('ohai')
|
33
43
|
end
|
34
44
|
end
|
35
45
|
|
36
|
-
it 'quiets the log when configured with a silenced path for non-standard requests' do
|
37
|
-
expect_any_instance_of(::Logger).to receive(:level=).with(::Logger::ERROR)
|
38
|
-
|
39
|
-
Silencer::Rack::Logger.new(app, silence: ['/'])
|
40
|
-
.call(Rack::MockRequest.env_for('/', method: 'UPDATE'))
|
41
|
-
end
|
42
|
-
|
43
46
|
it 'quiets the log when configured with a regex for non-standard requests' do
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
.call(Rack::MockRequest.env_for('/assets/application.css', method: 'UPDATE'))
|
47
|
+
a = Rack::Lint.new(Silencer::Rack::Logger.new(app, silence: [/assets/]))
|
48
|
+
Rack::MockRequest.new(a).get('/', 'rack.errors' => errors)
|
49
|
+
expect(errors).not_to match('ohai')
|
48
50
|
end
|
49
51
|
|
50
52
|
it 'quiets the log when passed a custom header "X-SILENCE-LOGGER"' do
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
.call(Rack::MockRequest.env_for('/', 'HTTP_X_SILENCE_LOGGER' => 'true'))
|
53
|
+
a = Rack::Lint.new(Silencer::Rack::Logger.new(app))
|
54
|
+
Rack::MockRequest.new(a).get('/', 'rack.errors' => errors, 'HTTP_X_SILENCE_LOGGER' => 'true')
|
55
|
+
expect(errors).not_to match('ohai')
|
55
56
|
end
|
56
57
|
|
57
58
|
it 'does not tamper with the response' do
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
expect(response[0]).to eq(200)
|
59
|
+
a = Rack::Lint.new(Silencer::Rack::Logger.new(app))
|
60
|
+
response = Rack::MockRequest.new(a).get('/', 'rack.errors' => errors, 'HTTP_X_SILENCE_LOGGER' => 'true')
|
61
|
+
expect(response.status).to eq(200)
|
62
62
|
end
|
63
63
|
end
|
@@ -1,9 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
require 'syslogger'
|
5
|
+
require 'silencer/rails/logger'
|
3
6
|
|
4
7
|
describe Silencer::Rails::Logger do
|
5
8
|
let(:app) { ->(_env) { [200, {}, ''] } }
|
6
|
-
let(:log_tags) { [
|
9
|
+
let(:log_tags) { %i[uuid queue] }
|
7
10
|
|
8
11
|
context 'quieted' do
|
9
12
|
before do
|
@@ -20,7 +23,7 @@ describe Silencer::Rails::Logger do
|
|
20
23
|
.call(Rack::MockRequest.env_for('/assets/application.css'))
|
21
24
|
end
|
22
25
|
|
23
|
-
%w
|
26
|
+
%w[OPTIONS GET HEAD POST PUT DELETE TRACE CONNECT PATCH].each do |method|
|
24
27
|
it "quiets the log when configured with a silenced path for #{method} requests" do
|
25
28
|
Silencer::Rails::Logger.new(app, method.downcase.to_sym => ['/'])
|
26
29
|
.call(Rack::MockRequest.env_for('/', method: method))
|
@@ -67,6 +70,22 @@ describe Silencer::Rails::Logger do
|
|
67
70
|
end
|
68
71
|
end
|
69
72
|
|
73
|
+
describe 'enable_header option' do
|
74
|
+
it 'does not quiet the log when passed a custom header "X-SILENCE-LOGGER" when enable_header option is false' do
|
75
|
+
expect_any_instance_of(Silencer::Rails::Logger).to_not receive(:quiet)
|
76
|
+
|
77
|
+
Silencer::Rails::Logger.new(app, enable_header: false)
|
78
|
+
.call(Rack::MockRequest.env_for('/', 'HTTP_X_SILENCE_LOGGER' => 'true'))
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'quiets the log when passed a custom header "X-SILENCE-LOGGER" when enable_header option is true' do
|
82
|
+
expect_any_instance_of(Silencer::Rails::Logger).to receive(:quiet).once.and_call_original
|
83
|
+
|
84
|
+
Silencer::Rails::Logger.new(app, enable_header: true)
|
85
|
+
.call(Rack::MockRequest.env_for('/', 'HTTP_X_SILENCE_LOGGER' => 'true'))
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
70
89
|
it 'silences' do
|
71
90
|
logger = Silencer::Rails::Logger.new(app, silence: ['/'])
|
72
91
|
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: silencer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Agalloco
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Selectively quiet your Rails/Rack logger on a per-route basis
|
14
14
|
email:
|
@@ -22,11 +22,10 @@ files:
|
|
22
22
|
- README.md
|
23
23
|
- Rakefile
|
24
24
|
- lib/silencer.rb
|
25
|
-
- lib/silencer/environment.rb
|
26
25
|
- lib/silencer/hush.rb
|
27
|
-
- lib/silencer/logger.rb
|
28
26
|
- lib/silencer/methods.rb
|
29
27
|
- lib/silencer/rack/logger.rb
|
28
|
+
- lib/silencer/rails/environment.rb
|
30
29
|
- lib/silencer/rails/logger.rb
|
31
30
|
- lib/silencer/util.rb
|
32
31
|
- lib/silencer/version.rb
|
@@ -38,7 +37,7 @@ files:
|
|
38
37
|
homepage: http://github.com/spagalloco/silencer
|
39
38
|
licenses: []
|
40
39
|
metadata: {}
|
41
|
-
post_install_message:
|
40
|
+
post_install_message:
|
42
41
|
rdoc_options: []
|
43
42
|
require_paths:
|
44
43
|
- lib
|
@@ -53,9 +52,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
53
52
|
- !ruby/object:Gem::Version
|
54
53
|
version: '0'
|
55
54
|
requirements: []
|
56
|
-
|
57
|
-
|
58
|
-
signing_key:
|
55
|
+
rubygems_version: 3.3.7
|
56
|
+
signing_key:
|
59
57
|
specification_version: 4
|
60
58
|
summary: Selectively quiet your Rails/Rack logger on a per-route basis
|
61
59
|
test_files:
|
data/lib/silencer/logger.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'silencer/rack/logger'
|
2
|
-
require 'silencer/environment'
|
3
|
-
|
4
|
-
module Silencer
|
5
|
-
# rubocop:disable Style/ConstantName
|
6
|
-
Logger = begin
|
7
|
-
if Silencer::Environment.rails?
|
8
|
-
require 'silencer/rails/logger'
|
9
|
-
Silencer::Rails::Logger
|
10
|
-
else
|
11
|
-
Silencer::Rack::Logger
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|