From 4f4a1cb883f53538ee25ba618aeae5d00202166f Mon Sep 17 00:00:00 2001 From: Magnus Ahltorp Date: Mon, 2 Feb 2015 16:47:01 +0100 Subject: Log time spent serving a request --- src/catlfish_web.erl | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/catlfish_web.erl') diff --git a/src/catlfish_web.erl b/src/catlfish_web.erl index f3231e4..9869b21 100644 --- a/src/catlfish_web.erl +++ b/src/catlfish_web.erl @@ -14,11 +14,13 @@ start(Options, Module) -> loop(Req, Module) -> "/" ++ Path = Req:get(path), try + Starttime = os:timestamp(), case Req:get(method) of 'GET' -> Query = Req:parse_qs(), lager:debug("GET ~p ~p", [Path, Query]), Result = Module:request(get, Path, Query), + lager:debug("GET finished: ~p us", [timer:now_diff(os:timestamp(), Starttime)]), case Result of none -> Req:respond({404, [{"Content-Type", "text/plain"}], "Page not found"}); @@ -29,6 +31,7 @@ loop(Req, Module) -> Body = Req:recv_body(), lager:debug("POST ~p ~p", [Path, Body]), Result = Module:request(post, Path, Body), + lager:debug("POST finished: ~p us", [timer:now_diff(os:timestamp(), Starttime)]), case Result of none -> Req:respond({404, [{"Content-Type", "text/plain"}], "Page not found"}); -- cgit v1.1