Sha256: 6f1a6002875c1060362e04591c43c9cded4dd9fb2fa62c0d6c6540298d626baf
Contents?: true
Size: 767 Bytes
Versions: 2
Compression:
Stored size: 767 Bytes
Contents
require 'rails/log_subscriber' module Rails module Rack # Log the request started and flush all loggers after it. class Logger < Rails::LogSubscriber def initialize(app) @app = app end def call(env) before_dispatch(env) @app.call(env) ensure after_dispatch(env) end protected def before_dispatch(env) request = ActionDispatch::Request.new(env) path = request.fullpath.inspect rescue "unknown" info "\n\nStarted #{request.method.to_s.upcase} #{path} " << "for #{request.remote_ip} at #{Time.now.to_s(:db)}" end def after_dispatch(env) Rails::LogSubscriber.flush_all! end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
railties-3.0.0.beta3 | lib/rails/rack/logger.rb |
railties-3.0.0.beta2 | lib/rails/rack/logger.rb |