Skip to content

Instantly share code, notes, and snippets.

@torkale
Created May 21, 2012 12:58
Show Gist options
  • Save torkale/2762195 to your computer and use it in GitHub Desktop.
Save torkale/2762195 to your computer and use it in GitHub Desktop.
def log(message)
delayed_message = proc{"#{Time.now.strftime("%T.%L")} pid:#{Process.pid} cache_id:#{@cache_id} #{message}"}
Rails.logger.error(" #{incr} #{delayed_message.()}")
res = yield
Rails.logger.error(" #{decr} #{delayed_message.()}")
res
end
def incr
@nesting ||= 0
@nesting += 1
"->" * @nesting
end
def decr
@nesting -= 1
"<-" * (@nesting + 1)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment