diff options
author | José Valim <jose.valim@gmail.com> | 2010-01-11 22:58:02 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-01-11 23:38:17 +0100 |
commit | d382e93d8f1a4e577bf408a952e1406ca6f47d27 (patch) | |
tree | bdc14db9652a53158be2b4cb7bc0ec0ff105bfc7 /actionpack/lib | |
parent | 8cb594a2e1808cd7d93f3593afed0414016fc56f (diff) | |
download | rails-d382e93d8f1a4e577bf408a952e1406ca6f47d27.tar.gz rails-d382e93d8f1a4e577bf408a952e1406ca6f47d27.tar.bz2 rails-d382e93d8f1a4e577bf408a952e1406ca6f47d27.zip |
Improve ActionPack logger output.
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/metal/logger.rb | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/actionpack/lib/action_controller/metal/logger.rb b/actionpack/lib/action_controller/metal/logger.rb index bf5f3b774f..e995d6bcea 100644 --- a/actionpack/lib/action_controller/metal/logger.rb +++ b/actionpack/lib/action_controller/metal/logger.rb @@ -56,7 +56,7 @@ module ActionController controller = payload[:controller] request = controller.request - logger.info "\n\nProcessed #{controller.class.name}##{payload[:action]} " \ + logger.info "\nProcessed #{controller.class.name}##{payload[:action]} " \ "to #{request.formats} (for #{request.remote_ip} at #{before.to_s(:db)}) " \ "[#{request.method.to_s.upcase}]" @@ -64,14 +64,13 @@ module ActionController message = "Completed in %.0fms" % duration message << " | #{controller.response.status}" - message << " [#{request.request_uri rescue "unknown"}]" + message << " [#{request.request_uri rescue "unknown"}]\n\n" logger.info(message) elsif name == "action_view.render_template" - # TODO Make render_template logging work if you are using just ActionView duration = (after - before) * 1000 - message = "Rendered #{payload[:identifier]}" - message << " within #{payload[:layout]}" if payload[:layout] + message = "Rendered #{from_rails_root(payload[:identifier])}" + message << " within #{from_rails_root(payload[:layout])}" if payload[:layout] message << (" (%.1fms)" % duration) logger.info(message) end @@ -85,6 +84,10 @@ module ActionController view_runtime = controller.send :view_runtime logger.info(" View runtime: %.1fms" % view_runtime.to_f) if view_runtime end + + def from_rails_root(string) + defined?(Rails.root) ? string.sub("#{Rails.root}/app/views/", "") : string + end end end end
\ No newline at end of file |