Skip to content
Browse files

Changed caching/expiration/hit to report using the DEBUG log level an…

…d errors to use the ERROR log level instead of both using INFO

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1889 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent d764392 commit 3835f6ab25053a64d9bac63bda5d3b62a242f91a @dhh dhh committed Jul 22, 2005
Showing with 14 additions and 12 deletions.
  1. +2 −0 actionpack/CHANGELOG
  2. +9 −9 actionpack/lib/action_controller/caching.rb
  3. +3 −3 actionpack/lib/action_view/base.rb
View
2 actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Changed caching/expiration/hit to report using the DEBUG log level and errors to use the ERROR log level instead of both using INFO
+
* Added support for per-action session management #1763
* Improved rendering speed on complicated templates by up to 25% #1234 [Stephan Kaes]. This did necessasitate a change to the internals of ActionView#render_template that now has four parameters. Developers of custom view handlers (like Amrita) need to update for that.
View
18 actionpack/lib/action_controller/caching.rb
@@ -75,7 +75,7 @@ module ClassMethods
def expire_page(path)
return unless perform_caching
File.delete(page_cache_path(path)) if File.exists?(page_cache_path(path))
- logger.info "Expired page: #{page_cache_file(path)}" unless logger.nil?
+ logger.debug "Expired page: #{page_cache_file(path)}" unless logger.nil?
end
# Manually cache the +content+ in the key determined by +path+. Example:
@@ -84,7 +84,7 @@ def cache_page(content, path)
return unless perform_caching
FileUtils.makedirs(File.dirname(page_cache_path(path)))
File.open(page_cache_path(path), "w+") { |f| f.write(content) }
- logger.info "Cached page: #{page_cache_file(path)}" unless logger.nil?
+ logger.debug "Cached page: #{page_cache_file(path)}" unless logger.nil?
end
# Caches the +actions+ using the page-caching approach that'll store the cache in a path within the page_cache_directory that
@@ -280,7 +280,7 @@ def write_fragment(name, content, options = {})
key = fragment_cache_key(name)
fragment_cache_store.write(key, content, options)
- logger.info "Cached fragment: #{key}" unless logger.nil?
+ logger.debug "Cached fragment: #{key}" unless logger.nil?
content
end
@@ -289,7 +289,7 @@ def read_fragment(name, options = {})
key = fragment_cache_key(name)
if cache = fragment_cache_store.read(key, options)
- logger.info "Fragment hit: #{key}" unless logger.nil?
+ logger.debug "Fragment hit: #{key}" unless logger.nil?
cache
else
false
@@ -307,10 +307,10 @@ def expire_fragment(name, options = {})
if key.is_a?(Regexp)
fragment_cache_store.delete_matched(key, options)
- logger.info "Expired fragments matching: #{key.source}" unless logger.nil?
+ logger.debug "Expired fragments matching: #{key.source}" unless logger.nil?
else
fragment_cache_store.delete(key, options)
- logger.info "Expired fragment: #{key}" unless logger.nil?
+ logger.debug "Expired fragment: #{key}" unless logger.nil?
end
end
@@ -362,7 +362,7 @@ def write(name, value, options = {}) #:nodoc:
ensure_cache_path(File.dirname(real_file_path(name)))
File.open(real_file_path(name), "w+") { |f| f.write(value) }
rescue => e
- Base.logger.info "Couldn't create cache directory: #{name} (#{e.message})" unless Base.logger.nil?
+ Base.logger.error "Couldn't create cache directory: #{name} (#{e.message})" unless Base.logger.nil?
end
def read(name, options = {}) #:nodoc:
@@ -372,7 +372,7 @@ def read(name, options = {}) #:nodoc:
def delete(name, options) #:nodoc:
File.delete(real_file_path(name))
rescue SystemCallError => e
- Base.logger.info "Couldn't expire cache #{name} (#{e.message})" unless Base.logger.nil?
+ Base.logger.error "Couldn't expire cache #{name} (#{e.message})" unless Base.logger.nil?
end
def delete_matched(matcher, options) #:nodoc:
@@ -381,7 +381,7 @@ def delete_matched(matcher, options) #:nodoc:
begin
File.delete(f)
rescue Object => e
- Base.logger.info "Couldn't expire cache: #{f} (#{e.message})" unless Base.logger.nil?
+ Base.logger.error "Couldn't expire cache: #{f} (#{e.message})" unless Base.logger.nil?
end
end
end
View
6 actionpack/lib/action_view/base.rb
@@ -323,8 +323,8 @@ def compile_erb_template(template, file_name)
def rhtml_render(extension, template, file_name, local_assigns)
render_sym = compile_erb_template(template, file_name)
saved_locals = evaluate_assigns(local_assigns)
- result = self.send render_sym
- saved_locals.each{|k,v| instance_variable_set k,v }
+ result = self.send(render_sym)
+ saved_locals.each { |k,v| instance_variable_set(k, v) }
result
end
@@ -333,7 +333,7 @@ def rxml_render(extension, template, file_name, local_assigns)
saved_locals = evaluate_assigns(local_assigns)
xml = Builder::XmlMarkup.new(:indent => 2)
result = eval(template, binding, '(template)(eval)', 1)
- saved_locals.each{|k,v| instance_variable_set k,v }
+ saved_locals.each { |k,v| instance_variable_set(k,v) }
result
end

0 comments on commit 3835f6a

Please sign in to comment.
Something went wrong with that request. Please try again.