X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=vendor%2Frails%2Frailties%2Flib%2Frails%2Frack%2Flog_tailer.rb;fp=vendor%2Frails%2Frailties%2Flib%2Frails%2Frack%2Flog_tailer.rb;h=0000000000000000000000000000000000000000;hb=36d9f3351a3b4e8159279445190e2287ffdea86c;hp=a237cee6bc68f2c1226d37f63e17020712c0fed7;hpb=913cf6054b1d29b5d2f5e620304af7ee77cc1f1f;p=feedcatcher.git diff --git a/vendor/rails/railties/lib/rails/rack/log_tailer.rb b/vendor/rails/railties/lib/rails/rack/log_tailer.rb deleted file mode 100644 index a237cee..0000000 --- a/vendor/rails/railties/lib/rails/rack/log_tailer.rb +++ /dev/null @@ -1,35 +0,0 @@ -module Rails - module Rack - class LogTailer - EnvironmentLog = "#{File.expand_path(Rails.root)}/log/#{Rails.env}.log" - - 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 - - def call(env) - response = @app.call(env) - tail_log - response - end - - 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 - end - end -end