Fiter out annoying "Could not determine content-length of response body." messages from verbose logging
This commit is contained in:
parent
324eac428e
commit
f908b378c5
1 changed files with 14 additions and 4 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
require "webrick"
|
||||||
|
|
||||||
module Middleman
|
module Middleman
|
||||||
|
|
||||||
WINDOWS = !!(RUBY_PLATFORM =~ /(mingw|bccwin|wince|mswin32)/i) unless const_defined?(:WINDOWS)
|
WINDOWS = !!(RUBY_PLATFORM =~ /(mingw|bccwin|wince|mswin32)/i) unless const_defined?(:WINDOWS)
|
||||||
|
@ -11,8 +13,6 @@ module Middleman
|
||||||
# Start an instance of Middleman::Application
|
# Start an instance of Middleman::Application
|
||||||
# @return [void]
|
# @return [void]
|
||||||
def start(options={})
|
def start(options={})
|
||||||
require "webrick"
|
|
||||||
|
|
||||||
app = ::Middleman::Application.server.inst do
|
app = ::Middleman::Application.server.inst do
|
||||||
if options[:environment]
|
if options[:environment]
|
||||||
set :environment, options[:environment].to_sym
|
set :environment, options[:environment].to_sym
|
||||||
|
@ -140,8 +140,10 @@ module Middleman
|
||||||
:AccessLog => []
|
:AccessLog => []
|
||||||
}
|
}
|
||||||
|
|
||||||
unless is_logging
|
if is_logging
|
||||||
http_opts[:Logger] = ::WEBrick::Log::new(nil, 0)
|
http_opts[:Logger] = FilteredWebrickLog.new
|
||||||
|
else
|
||||||
|
http_opts[:Logger] = ::WEBrick::Log.new(nil, 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
::WEBrick::HTTPServer.new(http_opts)
|
::WEBrick::HTTPServer.new(http_opts)
|
||||||
|
@ -171,5 +173,13 @@ module Middleman
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class FilteredWebrickLog < ::WEBrick::Log
|
||||||
|
def log(level, data)
|
||||||
|
unless data =~ %r{Could not determine content-length of response body.}
|
||||||
|
super(level, data)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue