Skip to content
This repository

Silent Sprockets logger when config.assets.logger is set to false (3-2-stable) #4518

Merged
merged 2 commits into from about 2 years ago

2 participants

Guillermo Iguaran José Valim
Guillermo Iguaran

No description provided.

José Valim josevalim merged commit f74afd9 into from January 18, 2012
José Valim josevalim closed this January 18, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
2  actionpack/CHANGELOG.md
Source Rendered
... ...
@@ -1,5 +1,7 @@
1 1
 ## Rails 3.2.0 (unreleased) ##
2 2
 
  3
+*   Setting config.assets.logger to false turn off Sprockets logger *Guillermo Iguaran*
  4
+
3 5
 *   Add `config.action_dispatch.default_charset` to configure default charset for ActionDispatch::Response. *Carlos Antonio da Silva*
4 6
 
5 7
 *   Deprecate setting default charset at controller level, use the new `config.action_dispatch.default_charset` instead. *Carlos Antonio da Silva*
5  actionpack/lib/sprockets/railtie.rb
@@ -21,9 +21,12 @@ class Railtie < ::Rails::Railtie
21 21
       require 'sprockets'
22 22
 
23 23
       app.assets = Sprockets::Environment.new(app.root.to_s) do |env|
24  
-        env.logger  = config.assets.logger || ::Rails.logger
25 24
         env.version = ::Rails.env + "-#{config.assets.version}"
26 25
 
  26
+        if config.assets.logger != false
  27
+          env.logger  = config.assets.logger || ::Rails.logger
  28
+        end
  29
+
27 30
         if config.assets.cache_store != false
28 31
           env.cache = ActiveSupport::Cache.lookup_store(config.assets.cache_store) || ::Rails.cache
29 32
         end
3  railties/guides/source/configuring.textile
Source Rendered
@@ -156,8 +156,7 @@ Rails 3.1, by default, is set up to use the +sprockets+ gem to manage assets wit
156 156
 
157 157
 * +config.assets.compile+ is a boolean that can be used to turn on live Sprockets compilation in production.
158 158
 
159  
-* +config.assets.logger+ accepts a logger conforming to the interface of Log4r or the default Ruby +Logger+ class. Defaults to the same configured at +config.logger+.
160  
-
  159
+* +config.assets.logger+ accepts a logger conforming to the interface of Log4r or the default Ruby +Logger+ class. Defaults to the same configured at +config.logger+. Setting +config.assets.logger+ to false will turn off served assets logging.
161 160
 
162 161
 h4. Configuring Generators
163 162
 
1  railties/lib/rails/application/configuration.rb
@@ -57,6 +57,7 @@ def initialize(*)
57 57
         @assets.js_compressor            = nil
58 58
         @assets.css_compressor           = nil
59 59
         @assets.initialize_on_precompile = true
  60
+        @assets.logger                   = nil
60 61
       end
61 62
 
62 63
       def compiled_asset_path
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.