lib/rack/olark.rb in rack-olark-0.0.8 vs lib/rack/olark.rb in rack-olark-0.1

- old
+ new

@@ -11,10 +11,11 @@ def initialize(app, options = {}) unless options[:id] && options[:id].length == 16 raise ArgumentError, 'Need a valid Olark ID!' end + @app, @options = app, DEFAULTS.merge(options) @id, @tag, @paths = [@options.delete(:id), @options.delete(:tag), @options.delete(:paths)] @@ -35,9 +36,16 @@ def _call(env) @status, @headers, @response = @app.call(env) @request = Rack::Request.new(env) valid_path = @paths.select { |path| @request.path_info =~ path }.length > 0 + + # Deprecation warning, repeated and annoying. Sorry about your log space. + if @options[:format] + logger = env['rack.errors'] + logger.write("[#{Time.now.strftime("%Y-%M-%d %H:%M:%S")}] WARNING ") + logger.write("Rack::Olark: The 'format' option no longer works! See README.md for details.\n") + end if html? && (@paths.empty? || valid_path) response = Rack::Response.new([], @status, @headers) @response.each { |fragment| response.write(inject(fragment)) } response.finish