Object
# File lib/rails/rack/log_tailer.rb, line 6 def initialize(app, log = nil) @app = app path = Pathname.new(log || EnvironmentLog).cleanpath @cursor = ::File.size(path) @last_checked = Time.now.to_f @file = ::File.open(path, 'r') end
# File lib/rails/rack/log_tailer.rb, line 16 def call(env) response = @app.call(env) tail_log response end
# File lib/rails/rack/log_tailer.rb, line 22 def tail_log @file.seek @cursor mod = @file.mtime.to_f if mod > @last_checked contents = @file.read @last_checked = mod @cursor += contents.size $stdout.print contents end end
[Validate]
Generated with the Darkfish Rdoc Generator 2.