ultimate-log-silencer 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .idea/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ultimate-log-silencer.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,5 @@
1
+ Dual licensed under the MIT and GPL licenses:
2
+ http://www.opensource.org/licenses/mit-license.php
3
+ http://www.gnu.org/licenses/gpl.html
4
+
5
+ Copyright (c) 2011-2012 Dmitry KODer Karpunun / Evrone.com
data/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # Ultimate Log Silencer
2
+
3
+ Ultimate Log Silencer mutes assets pipeline log-messages, sort of:
4
+
5
+ ```log
6
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2012-02-13 13:24:04 +0400
7
+ Served asset /application.js - 304 Not Modified (8ms)
8
+ ```
9
+
10
+ Support Ruby on Rails 3.1, 3.2.
11
+
12
+ ## Installation
13
+
14
+ Add this line to your application's Gemfile:
15
+
16
+ gem 'ultimate-log-silencer'
17
+
18
+ And then execute:
19
+
20
+ $ bundle
21
+
22
+ Or install it yourself as:
23
+
24
+ $ gem install ultimate-log-silencer
25
+
26
+ ## Usage
27
+
28
+ Nothing more, but you can change some options:
29
+
30
+ ```ruby
31
+ # Assign null-logger for assets.
32
+ config.ultimate_log_silencer.assets_logger_off = false
33
+ # Off messages from Rack by request path.
34
+ config.ultimate_log_silencer.rack_logger_assets_off = true
35
+ # RegExp for detect request to assets.
36
+ config.ultimate_log_silencer.assets_path_regexp = /^\/assets\//
37
+ ```
38
+
39
+ ## License
40
+
41
+ Dual licensed under the MIT and GPL licenses:
42
+
43
+ + http://www.opensource.org/licenses/mit-license.php
44
+ + http://www.gnu.org/licenses/gpl.html
45
+
46
+ Copyright © 2011-2012 Dmitry KODer Karpunun / Evrone.com
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,10 @@
1
+ require "ultimate-log-silencer/version"
2
+ require "ultimate-log-silencer/engine"
3
+
4
+ module Ultimate
5
+ module Log
6
+ module Silencer
7
+
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,25 @@
1
+ module Ultimate
2
+ module Log::Silencer
3
+
4
+ class Configuration
5
+
6
+ # Assign null-logger for assets.
7
+ attr_accessor :assets_logger_off
8
+
9
+ # Off messages from Rack by request path.
10
+ attr_accessor :rack_logger_assets_off
11
+
12
+ # RegExp for detect request to assets.
13
+ attr_accessor :assets_path_regexp
14
+
15
+ def initialize
16
+ # Set configuration defaults.
17
+ @assets_logger_off = false
18
+ @rack_logger_assets_off = true
19
+ @assets_path_regexp = /^\/assets\//
20
+ end
21
+
22
+ end
23
+
24
+ end
25
+ end
@@ -0,0 +1,15 @@
1
+ require "ultimate-log-silencer/configuration"
2
+
3
+ module Ultimate
4
+ module Log
5
+ module Silencer
6
+ class Engine < ::Rails::Engine
7
+ config.ultimate_log_silencer = Ultimate::Log::Silencer::Configuration.new
8
+
9
+ initializer "ultimate-log-sillencer.quiet_assets", :after => "sprockets.environment" do
10
+ require "ultimate-log-silencer/quiet_assets"
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,16 @@
1
+ if Rails.application.config.ultimate_log_silencer.assets_logger_off
2
+ Rails.application.assets.logger = Logger.new(RUBY_PLATFORM =~ /(win|w)32$/ ? "NUL" : "/dev/null")
3
+ end
4
+
5
+ if Rails.application.config.ultimate_log_silencer.rack_logger_assets_off
6
+ Rails::Rack::Logger.class_eval do
7
+ def call_with_quiet_assets(env)
8
+ previous_level = Rails.logger.level
9
+ Rails.logger.level = Logger::ERROR if Rails.application.config.ultimate_log_silencer.assets_path_regexp =~ env['PATH_INFO']
10
+ call_without_quiet_assets(env).tap do
11
+ Rails.logger.level = previous_level
12
+ end
13
+ end
14
+ alias_method_chain :call, :quiet_assets
15
+ end
16
+ end
@@ -0,0 +1,7 @@
1
+ module Ultimate
2
+ module Log
3
+ module Silencer
4
+ VERSION = "0.1.1"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/ultimate-log-silencer/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.name = "ultimate-log-silencer"
6
+ gem.version = Ultimate::Log::Silencer::VERSION
7
+ gem.authors = ["Dmitry KODer Karpunin"]
8
+ gem.email = ["koderfunk@gmail.com"]
9
+ gem.homepage = "http://github.com/evrone/ultimate-log-silencer"
10
+ gem.description = %q{Ultimate Log Silencer mutes assets pipeline log-messages.}
11
+ gem.summary = %q{Ultimate Log Silencer mutes assets pipeline log-messages.}
12
+
13
+ gem.add_dependency "rails", "~> 3.1"
14
+
15
+ gem.files = `git ls-files`.split("\n")
16
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
+ gem.require_paths = ["lib"]
19
+
20
+ end
metadata ADDED
@@ -0,0 +1,67 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ultimate-log-silencer
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Dmitry KODer Karpunin
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-02-13 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: &13576740 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '3.1'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *13576740
25
+ description: Ultimate Log Silencer mutes assets pipeline log-messages.
26
+ email:
27
+ - koderfunk@gmail.com
28
+ executables: []
29
+ extensions: []
30
+ extra_rdoc_files: []
31
+ files:
32
+ - .gitignore
33
+ - Gemfile
34
+ - LICENSE
35
+ - README.md
36
+ - Rakefile
37
+ - lib/ultimate-log-silencer.rb
38
+ - lib/ultimate-log-silencer/configuration.rb
39
+ - lib/ultimate-log-silencer/engine.rb
40
+ - lib/ultimate-log-silencer/quiet_assets.rb
41
+ - lib/ultimate-log-silencer/version.rb
42
+ - ultimate-log-silencer.gemspec
43
+ homepage: http://github.com/evrone/ultimate-log-silencer
44
+ licenses: []
45
+ post_install_message:
46
+ rdoc_options: []
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ! '>='
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ requirements: []
62
+ rubyforge_project:
63
+ rubygems_version: 1.8.10
64
+ signing_key:
65
+ specification_version: 3
66
+ summary: Ultimate Log Silencer mutes assets pipeline log-messages.
67
+ test_files: []