more granular memory use logging

This commit is contained in:
albert
2013-02-17 19:29:38 -05:00
parent 88c72cac5c
commit a00f546254
2 changed files with 9 additions and 3 deletions

View File

@@ -13,9 +13,7 @@ class ApplicationController < ActionController::Base
protected
def log_memory_usage
Rails.logger.info "\e[1;31mMemory usage:\e[0m #{Memorylogic.memory_usage}"
Rails.logger.info" \e[1;31mParams:\e[0m #{params.inspect}"
Rails.logger.info "\e[1;31mUser: \e[0m#{CurrentUser.id}"
Rails.logger.info "\e[1;31mMemory usage:\e[0m #{Memorylogic.memory_usage}\t\e[1;31mParams:\e[0m #{params.inspect}\t\e[1;31mUser: \e[0m#{CurrentUser.id}"
end
def access_denied

View File

@@ -0,0 +1,8 @@
ActiveSupport::BufferedLogger.class_eval do
def add_with_memory_info(severity, message = nil, progname = nil, &block)
str = "\t\e[1;31mMemory usage:\e[0m #{Memorylogic.memory_usage}"
add_without_memory_info(severity, message + str, progname, &block)
end
alias_method_chain :add, :memory_info
end