Sha256: c5fe99e0968d459b5587df2e8f67ce718f6c6e2915f6e0cedd3b526f87bd7941
Contents?: true
Size: 849 Bytes
Versions: 18
Compression:
Stored size: 849 Bytes
Contents
require 'rack' class QuietCommonLogger < Rack::CommonLogger include Rack @@ignore_extensions = %w(png jpg jpeg ico gif woff tff svg eot css js) def call(env) path = env['REQUEST_PATH'] began_at = Time.now status, header, body = @app.call(env) header = Utils::HeaderHash.new(header) base = ::File.basename(path) if base.index('.') ext = base.split('.').last else ext = nil end body = BodyProxy.new(body) do # Don't log on ignored extensions unless @@ignore_extensions.include?(ext) log(env, status, header, began_at) end end # Because of web sockets, the initial request doesn't finish, so we # can just trigger it now. unless ext || path.start_with?('/channel') log(env, status, header, began_at) end [status, header, body] end end
Version data entries
18 entries across 18 versions & 1 rubygems