quiet_rails_logger 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7b91b1d0bf0c5b5e0908d5a15a9ed1afc1124188
4
+ data.tar.gz: 22ab705025fef74acc79f510d0c8314275892b98
5
+ SHA512:
6
+ metadata.gz: 6f5e55d5a837a2a235c51a88b2dd5ed9af0dc4edf6867f33d01363079e9a7f52fff33409ce8fa6026be6a7994298f08b1459e8c454cbcd6f8874261c4e12c54a
7
+ data.tar.gz: e034846694f36c5fa2db2c1d03218aa7cd283cb1586400184db88972c8e749d36528d7fdbfa1dbafc52425248361b4efd0859a4ccf4fcf2930dde0e454da327d
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2018 skrinits
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # QuietRailsLogger
2
+ Stop logging of need not messages to log with an INFO level in production and staging enviroments, example:
3
+
4
+ >[2018-05-06 14:54:05] INFO Started GET "/" for 127.0.0.1 at 2018-05-06 14:54:05 +0300
5
+ >[2018-05-06 14:54:05] INFO Processing by HomeController#index as HTML
6
+ >[2018-05-06 14:54:05] INFO Parameters: {"url_prefix"=>""}
7
+ >[2018-05-06 14:54:05] INFO Rendered home/index.html.slim (9.9ms)
8
+ >[2018-05-06 14:54:06] INFO Completed 200 OK in 1068ms (Views: 953.2ms | ActiveRecord: 4.6ms)
9
+
10
+ ## Usage
11
+ Add to config/initializers/quiet_rails_logger.rb:
12
+
13
+ ```ruby
14
+ QuietRailsLogger.configure do |config|
15
+ config.environments = %w[production staging]
16
+ end
17
+ ```
18
+
19
+ ## Installation
20
+ Add this line to your application's Gemfile:
21
+
22
+ ```ruby
23
+ gem 'quiet_rails_logger'
24
+ ```
25
+
26
+ And then execute:
27
+ ```bash
28
+ $ bundle
29
+ ```
30
+
31
+ ## License
32
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,33 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'QuietRailsLogger'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+
18
+
19
+
20
+
21
+
22
+ require 'bundler/gem_tasks'
23
+
24
+ require 'rake/testtask'
25
+
26
+ Rake::TestTask.new(:test) do |t|
27
+ t.libs << 'test'
28
+ t.pattern = 'test/**/*_test.rb'
29
+ t.verbose = false
30
+ end
31
+
32
+
33
+ task default: :test
@@ -0,0 +1,9 @@
1
+ module QuietRailsLogger
2
+ class Configuration
3
+ attr_accessor :environments
4
+
5
+ def initialize
6
+ @environments = %w[staging production]
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ module QuietRailsLogger
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,27 @@
1
+ require 'quiet_rails_logger/configuration'
2
+
3
+ module QuietRailsLogger
4
+ class << self
5
+ def configuration
6
+ @configuration ||= QuietRailsLogger::Configuration.new
7
+ end
8
+
9
+ def configure
10
+ yield(configuration)
11
+ end
12
+ end
13
+
14
+ class Engine < ::Rails::Engine
15
+ initializer 'quiet_rails_logger.skip_info_messages' do |app|
16
+ if Rails.env.in?(QuietRailsLogger.configuration.environments)
17
+ ActiveSupport::Subscriber.subscribers.each do |subscriber|
18
+ subscriber.patterns.each do |pattern|
19
+ ActiveSupport::Notifications.unsubscribe(pattern)
20
+ end
21
+ end
22
+
23
+ app.middleware.delete Rails::Rack::Logger
24
+ end
25
+ end
26
+ end
27
+ end
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: quiet_rails_logger
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - skrinits
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-05-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 4.0.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 4.0.0
27
+ description: Stop logging of need not messages to log with an INFO level in production
28
+ and staging enviroments
29
+ email:
30
+ - 110100reg@gmail.com
31
+ executables: []
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - MIT-LICENSE
36
+ - README.md
37
+ - Rakefile
38
+ - lib/quiet_rails_logger.rb
39
+ - lib/quiet_rails_logger/configuration.rb
40
+ - lib/quiet_rails_logger/version.rb
41
+ homepage: https://github.com/skrinits/quiet_rails_logger
42
+ licenses:
43
+ - MIT
44
+ metadata: {}
45
+ post_install_message:
46
+ rdoc_options: []
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ requirements: []
60
+ rubyforge_project:
61
+ rubygems_version: 2.6.14
62
+ signing_key:
63
+ specification_version: 4
64
+ summary: Quiet rails logger's messages with an INFO level
65
+ test_files: []