Rails 요청 프로파일 러와 함께 사용할 스크립트를 만드는 가장 좋은 방법은 무엇입니까?
-
02-07-2019 - |
문제
철도는 script/performance/request
세션 스크립트가 필요합니다.이 세션 스크립트를 생성하는 가장 좋은 방법은 무엇입니까?
해결책
이 코드를 application.rb 파일에 추가하십시오
before_filter :benchmark_log
def benchmark_log
File.open("request_log.txt","a") do |f|
f.puts request.method.to_s + " '" + request.request_uri + "', " + params.except(:action).except(:controller).inspect.gsub(/(^\{|\}$)/,"")
end
end
그런 다음 브라우저에서 여러 페이지를 방문하면 세션 스크립트가 응용 프로그램 루트 디렉토리의 request_log.txt 파일에 기록됩니다.
제휴하지 않습니다 StackOverflow