Skip to content

Commit cf8ed5c

Browse files
committed
Disable Assets Logger
1 parent 70cf847 commit cf8ed5c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

config/environments/development.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
class DisableAssetsLogger
2+
def initialize(app)
3+
@app = app
4+
Rails.application.assets.logger = Logger.new('/dev/null')
5+
end
6+
7+
def call(env)
8+
previous_level = Rails.logger.level
9+
Rails.logger.level = Logger::ERROR if env['PATH_INFO'].index("/assets/") == 0
10+
@app.call(env)
11+
ensure
12+
Rails.logger.level = previous_level
13+
end
14+
end
15+
116
SampleApp::Application.configure do
217
# Settings specified here will take precedence over those in config/application.rb
318

@@ -34,4 +49,7 @@
3449

3550
# Expands the lines which load the assets
3651
config.assets.debug = true
52+
53+
config.assets.logger = false
54+
config.middleware.insert_before Rails::Rack::Logger, DisableAssetsLogger
3755
end

0 commit comments

Comments
 (0)