lib/safe_cookies.rb in safe_cookies-0.2.0 vs lib/safe_cookies.rb in safe_cookies-0.2.1

- old
+ new

@@ -62,10 +62,13 @@ def check_if_request_has_unknown_cookies request_cookie_names = request_cookies.keys.map(&:to_s) unknown_cookie_names = request_cookie_names - known_cookie_names if unknown_cookie_names.any? + message = "Request for '#{@request.url}' had unknown cookies: #{unknown_cookie_names.join(', ')}" + log(message) if @config.log_unknown_cookies + handle_unknown_cookies(unknown_cookie_names) end end # Overwrites @header['Set-Cookie']! @@ -126,14 +129,13 @@ end end # API method def handle_unknown_cookies(cookie_names) - log_error("Request for '#{@request.url}' had unknown cookies: #{cookie_names.join(', ')}") end - def log_error(error_message) - message = '** [SafeCookies error] ' + def log(error_message) + message = '** [SafeCookies] ' message << error_message Rails.logger.error(message) if defined?(Rails) end