Sha256: a70496f51fc54c8331119a605b4c3ca4a555e82578e3da06e10d66ede0db18e7
Contents?: true
Size: 594 Bytes
Versions: 75
Compression:
Stored size: 594 Bytes
Contents
module Rails module Rack class LogTailer def initialize(app, log = nil) @app = app path = Pathname.new(log || "#{File.expand_path(Rails.root)}/log/#{Rails.env}.log").cleanpath @cursor = ::File.size(path) @file = ::File.open(path, 'r') end def call(env) response = @app.call(env) tail! response end def tail! @file.seek @cursor unless @file.eof? contents = @file.read @cursor = @file.tell $stdout.print contents end end end end end
Version data entries
75 entries across 62 versions & 4 rubygems